This is an automated email from the ASF dual-hosted git repository. mmiller pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/accumulo.git
commit bd550e432d320540ccaf33509d33ca35759e2ef0 Merge: 9f29f37 18e8239 Author: Mike Miller <[email protected]> AuthorDate: Wed Aug 12 09:08:11 2020 -0400 Merge branch '1.9' into main Conflicts: server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/MinorCompactionTask.java .../accumulo/tserver/tablet/MinorCompactionTask.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --cc server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/MinorCompactionTask.java index 5209fe2,8f922d2..83d060f --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/MinorCompactionTask.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/MinorCompactionTask.java @@@ -57,47 -56,54 +57,56 @@@ class MinorCompactionTask implements Ru @Override public void run() { tablet.minorCompactionStarted(); - ProbabilitySampler sampler = new ProbabilitySampler(tracePercent); - Span minorCompaction = Trace.on("minorCompaction", sampler); + ProbabilitySampler sampler = TraceUtil.probabilitySampler(tracePercent); try { - Span span = Trace.start("waitForCommits"); - synchronized (tablet) { - commitSession.waitForCommitsToFinish(); - } - span.stop(); - span = Trace.start("start"); - FileRef newMapfileLocation = null; - FileRef tmpFileRef = null; - while (true) { - try { - if (newMapfileLocation == null) { - newMapfileLocation = tablet.getNextMapFilename(mergeFile == null ? "F" : "M"); - tmpFileRef = new FileRef(newMapfileLocation.path() + "_tmp"); + try (TraceScope minorCompaction = Trace.startSpan("minorCompaction", sampler)) { - TabletFile newFile = tablet.getNextMapFilename("F"); - TabletFile tmpFile = new TabletFile(new Path(newFile.getPathStr() + "_tmp")); + try (TraceScope span = Trace.startSpan("waitForCommits")) { + synchronized (tablet) { + commitSession.waitForCommitsToFinish(); } - // the purpose of the minor compaction start event is to keep track of the filename... in - // the case - // where the metadata table write for the minor compaction finishes and the process dies - // before - // writing the minor compaction finish event, then the start event+filename in metadata - // table will - // prevent recovery of duplicate data... the minor compaction start event could be written - // at any time - // before the metadata write for the minor compaction - tablet.getTabletServer().minorCompactionStarted(commitSession, - commitSession.getWALogSeq() + 1, newMapfileLocation.path().toString()); - break; - } catch (IOException e) { - // An IOException could have occurred while creating the new file - if (newMapfileLocation == null) - log.warn("Failed to create new file for minor compaction {}", e.getMessage(), e); - else - log.warn("Failed to write to write ahead log {}", e.getMessage(), e); } - } - span.stop(); - span = Trace.start("compact"); - this.stats = tablet.minorCompact(tablet.getTabletServer().getFileSystem(), - tablet.getTabletMemory().getMinCMemTable(), tmpFileRef, newMapfileLocation, mergeFile, - true, queued, commitSession, flushId, mincReason); - span.stop(); ++ TabletFile newFile = null; ++ TabletFile tmpFile = null; + try (TraceScope span = Trace.startSpan("start")) { + while (true) { + try { ++ if (newFile == null) { ++ newFile = tablet.getNextMapFilename("F"); ++ tmpFile = new TabletFile(new Path(newFile.getPathStr() + "_tmp")); ++ } + /* + * the purpose of the minor compaction start event is to keep track of the filename... + * in the case where the metadata table write for the minor compaction finishes and + * the process dies before writing the minor compaction finish event, then the start + * event+filename in metadata table will prevent recovery of duplicate data... the + * minor compaction start event could be written at any time before the metadata write + * for the minor compaction + */ + tablet.getTabletServer().minorCompactionStarted(commitSession, + commitSession.getWALogSeq() + 1, newFile.getMetaInsert()); + break; + } catch (IOException e) { - log.warn("Failed to write to write ahead log {}", e.getMessage(), e); ++ // An IOException could have occurred while creating the new file ++ if (newFile == null) ++ log.warn("Failed to create new file for minor compaction {}", e.getMessage(), e); ++ else ++ log.warn("Failed to write to write ahead log {}", e.getMessage(), e); ++ + } + } + } + try (TraceScope span = Trace.startSpan("compact")) { + this.stats = tablet.minorCompact(tablet.getTabletMemory().getMinCMemTable(), tmpFile, + newFile, queued, commitSession, flushId, mincReason); + } - minorCompaction.data("extent", tablet.getExtent().toString()); - minorCompaction.data("numEntries", Long.toString(this.stats.getNumEntries())); - minorCompaction.data("size", Long.toString(this.stats.getSize())); - minorCompaction.stop(); + if (minorCompaction.getSpan() != null) { + minorCompaction.getSpan().addKVAnnotation("extent", tablet.getExtent().toString()); + minorCompaction.getSpan().addKVAnnotation("numEntries", + Long.toString(this.stats.getNumEntries())); + minorCompaction.getSpan().addKVAnnotation("size", Long.toString(this.stats.getSize())); + } + } if (tablet.needsSplit()) { tablet.getTabletServer().executeSplit(tablet);
