Skip to content

Use TExternalCompaction instead of RunningCompaction#6221

Merged
dlmarion merged 2 commits intoapache:mainfrom
dlmarion:compactor-get-running-changes
Mar 16, 2026
Merged

Use TExternalCompaction instead of RunningCompaction#6221
dlmarion merged 2 commits intoapache:mainfrom
dlmarion:compactor-get-running-changes

Conversation

@dlmarion
Copy link
Contributor

This change removes the RunningCompaction object and replaces it with TExternalCompaction. Both objects were similar except for the startTime, which I added to TExternalCompaction.

This change will make removing the collections from the coordinator easier in subsequent changes while keeping the same amount of information.

This change removes the RunningCompaction object and replaces
it with TExternalCompaction. Both objects were similar except
for the startTime, which I added to TExternalCompaction.

This change will make removing the collections from the
coordinator easier in subsequent changes while keeping
the same amount of information.
@dlmarion dlmarion added this to the 4.0.0 milestone Mar 16, 2026
@dlmarion dlmarion requested a review from keith-turner March 16, 2026 18:44
@dlmarion dlmarion self-assigned this Mar 16, 2026
@dlmarion dlmarion merged commit 1193b2a into apache:main Mar 16, 2026
9 checks passed
@dlmarion dlmarion deleted the compactor-get-running-changes branch March 16, 2026 20:45
Comment on lines -1123 to +1127
RUNNING_CACHE.forEach((ecid, rc) -> {
TExternalCompaction trc = new TExternalCompaction();
trc.setGroupName(rc.getGroup().canonical());
trc.setCompactor(rc.getCompactorAddress());
trc.setUpdates(rc.getUpdates());
trc.setJob(rc.getJob());
result.putToCompactions(ecid.canonical(), trc);
RUNNING_CACHE.forEach((ecid, tec) -> {
result.putToCompactions(ecid.canonical(), tec);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we used to build a new object now we use the object directly from the cache. Could this cause CME?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so as RUNNING_CACHE is a ConcurrentHashMap. Is there something that you see that might be an issue?

Comment on lines -419 to +422
rc.addUpdate(System.currentTimeMillis(), update);
rc.setStartTime(this.coordinatorStartTime);
RUNNING_CACHE.put(ExternalCompactionId.of(rc.getJob().getExternalCompactionId()), rc);
tec.putToUpdates(coordinatorStartTime, update);
RUNNING_CACHE.put(ExternalCompactionId.of(tec.getJob().getExternalCompactionId()), tec);
LONG_RUNNING_COMPACTIONS_BY_RG
.computeIfAbsent(rc.getGroup().canonical(), k -> new TimeOrderedRunningCompactionSet())
.add(rc);
.computeIfAbsent(tec.getGroupName(), k -> new TimeOrderedRunningCompactionSet())
.add(tec);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The start time is not set here anymore. Is that intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's being set in the Compactor

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I commented on the wrong part of the code here on github. What I was thinking is in getCompactionJob() a TExtaernalCompaction object is created with no startTime set and stores it in RUNNING_CACHE. Unless im missing something that code you linked is for a different collection of TExtaernalCompaction objects (which do set the startTime).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you are right that startTime is not set on the TExternalCompaction objects in the RUNNING_CACHE. Looking at the code, I don't think it's using the startTime in the coordinator code. In #6223, I'm moving the long running map to the Monitor, I think that might be the only thing using the startTime, but in #6223 it's getting the TExternalCompaction directly from the compactors instead of the coordinator. I'll see if I can clean this up a bit in #6223.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DomGarguilo - great catch. I went back and reviewed the changes and setting the start time is missing. I created #6225 to add this back. Thanks!

dlmarion added a commit to dlmarion/accumulo that referenced this pull request Mar 19, 2026
In apache#6221 we removed the RunningCompaction object in favor
of using TExternalCompaction. The RunningCompaction object
was setting its start time variable when the STARTED update
msg was added. This behavior was lost in apache#6221. This change
adds it back by setting the start time on the TExternalCompaction
object when the STARTED msg is received.
dlmarion added a commit that referenced this pull request Mar 19, 2026
In #6221 we removed the RunningCompaction object in favor
of using TExternalCompaction. The RunningCompaction object
was setting its start time variable when the STARTED update
msg was added. This behavior was lost in #6221. This change
adds it back by setting the start time on the TExternalCompaction
object when the STARTED msg is received.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants