You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by kt...@apache.org on 2021/09/02 13:01:31 UTC
[accumulo] branch main updated: Prevents compaction when tablet
does not know of files (#2258)
This is an automated email from the ASF dual-hosted git repository.
kturner pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push:
new 0bf3c9e Prevents compaction when tablet does not know of files (#2258)
0bf3c9e is described below
commit 0bf3c9e7056fbdc8c1dfd53ddc0b62a74d7c31b0
Author: Keith Turner <kt...@apache.org>
AuthorDate: Thu Sep 2 09:01:23 2021 -0400
Prevents compaction when tablet does not know of files (#2258)
---
.../org/apache/accumulo/tserver/tablet/CompactableImpl.java | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactableImpl.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactableImpl.java
index 553831d..47b1861 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactableImpl.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactableImpl.java
@@ -1110,6 +1110,18 @@ public class CompactableImpl implements Compactable {
cInfo.localCompactionCfg = this.compactionConfig;
}
+ // Check to ensure the tablet actually has these files now that they are reserved. Compaction
+ // jobs are queued for some period of time and then they try to run. Things could change while
+ // they are queued. This check ensures that the files a job is reserving still exists in the
+ // tablet. Without this check the compaction could run and then fail to commit on the tablet.
+ // The tablet and this class have separate locks that should not be held at the same time. This
+ // check is done after the file are exclusively reserved in this class to avoid race conditions.
+ if (!tablet.getDatafiles().keySet().containsAll(cInfo.jobFiles)) {
+ // The tablet does not know of all these files, so unreserve them.
+ completeCompaction(job, cInfo.jobFiles, null);
+ return Optional.empty();
+ }
+
return Optional.of(cInfo);
}