sunhelly commented on a change in pull request #375: HBASE-21426
TestEncryptionKeyRotation.testCFKeyRotation is flaky
URL: https://github.com/apache/hbase/pull/375#discussion_r303344354
##########
File path:
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestEncryptionKeyRotation.java
##########
@@ -133,27 +135,14 @@ public void testCFKeyRotation() throws Exception {
// And major compact
TEST_UTIL.getAdmin().majorCompact(htd.getTableName());
- final List<Path> updatePaths =
findCompactedStorefilePaths(htd.getTableName());
- TEST_UTIL.waitFor(30000, 1000, true, new Predicate<Exception>() {
+ // waiting for the major compaction to complete
+ TEST_UTIL.waitFor(30000, new Waiter.Predicate<IOException>() {
@Override
- public boolean evaluate() throws Exception {
- // When compaction has finished, all of the original files will be
- // gone
- boolean found = false;
- for (Path path: updatePaths) {
- found = TEST_UTIL.getTestFileSystem().exists(path);
- if (found) {
- LOG.info("Found " + path);
- break;
- }
- }
- return !found;
+ public boolean evaluate() throws IOException {
+ return TEST_UTIL.getAdmin().getCompactionState(htd.getTableName()) ==
+ CompactionState.NONE;
Review comment:
Hi, @xcangCRM , thanks your questions.
> How is this sufficient? Can this state never changed?
We all know majorCompact() is a async method, returning not means compaction
completed.
But the method will return after building the compaction context and adding
the compaction to the executor pool. And before the executor runs compaction,
when building the compaction context, state of table regions that want to
compact will be set to MAJOR by calling reportCompactionRequestStart(). So
calling majorCompact() returns means table compaction state is not 'NONE' until
the major compaction is completed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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