ctubbsii commented on a change in pull request #541: fixes #538 fix WAL
recovery code
URL: https://github.com/apache/accumulo/pull/541#discussion_r197555535
##########
File path:
server/tserver/src/main/java/org/apache/accumulo/tserver/log/SortedLogRecovery.java
##########
@@ -190,38 +189,29 @@ private long findLastStartToFinish(List<Path>
recoveryLogs, Set<String> tabletFi
lastStart = key.seq;
lastStartFile = key.filename;
} else if (key.event == COMPACTION_FINISH) {
- if (lastEvent == null) {
- firstEventWasFinish = true;
- } else if (lastEvent == COMPACTION_FINISH) {
- throw new IllegalStateException(
- "Saw consecutive COMPACTION_FINISH events " + key.tabletId + "
" + key.seq);
- } else {
- if (key.seq <= lastStart) {
- throw new IllegalStateException(
- "Compaction finish <= start " + lastStart + " " + key.seq);
- }
- recoverySeq = lastStart;
- lastStartFile = null;
- sawStartFinish = true;
- }
+ checkState(key.seq >= lastFinish); // should only fail if bug
elsewhere
+ checkState(key.seq > lastStart, "Compaction finish <= start %s %s
%s", key.tabletId,
+ key.seq, lastStart);
+ checkState(lastEvent == null || lastEvent == COMPACTION_START,
+ "Saw consecutive COMPACTION_FINISH events %s %s %s",
key.tabletId, lastFinish,
+ key.seq);
+ lastFinish = key.seq;
} else {
throw new IllegalStateException("Non compaction event seen " +
key.event);
}
lastEvent = key.event;
}
- if (firstEventWasFinish && !sawStartFinish) {
- throw new IllegalStateException("COMPACTION_FINISH (without preceding
COMPACTION_START)"
- + " is not followed by a successful minor compaction.");
- }
-
- if (lastStartFile != null &&
suffixes.contains(getPathSuffix(lastStartFile))) {
- // There was no compaction finish event, however the last compaction
start event has a file
- // in the metadata table, so the compaction finished.
+ if (lastStart > lastFinish && lastStartFile != null
Review comment:
This might be more clear if it just said something like `if lastEvent ==
COMPACTION_START`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services