Skip to content

Commit 55206be

Browse files
committed
Do not remove the writer from 'writers' until after the writer is committed,
otherwise its files will not appear in the results of getCompactionTargets.
1 parent 7198932 commit 55206be

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

  • hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions

hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/compactions/Compactor.java

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -380,20 +380,23 @@ protected final List<Path> compact(final CompactionRequestImpl request,
380380
this.progress.remove(progress);
381381
}
382382
if (writer != null) {
383-
if (!finished) {
384-
abortWriter(writer);
385-
return Collections.emptyList();
383+
try {
384+
if (!finished) {
385+
// There was an error, so abort the writer.
386+
abortWriter(writer);
387+
return Collections.emptyList();
388+
} else {
389+
// Finished, commit the writer's results.
390+
return commitWriter(writer, fd, request);
391+
}
392+
} finally {
393+
writers.remove(writer);
386394
}
387-
writers.remove(writer);
388395
}
389396
}
390-
if (!finished) {
391-
throw new IllegalStateException("We should have exited the method on all error paths");
392-
}
393-
if (writer == null) {
394-
throw new IllegalStateException("Writer should be non-null if no error");
395-
}
396-
return commitWriter(writer, fd, request);
397+
// We have fallen through to here if the compaction was aborted and there was nothing
398+
// to commit.
399+
return Collections.emptyList();
397400
}
398401

399402
protected abstract List<Path> commitWriter(T writer, FileDetails fd,

0 commit comments

Comments
 (0)