Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHOENIX-5676 Inline-verification from IndexTool does not handle TTL/r… #685

Closed

Conversation

abhishek-chouhan
Copy link
Contributor

…ow-expiry

@@ -584,16 +633,19 @@ public boolean next(List<Cell> results) throws IOException {
if (onlyVerify) {
addToBeVerifiedIndexRows();
}
ArrayList<KeyRange> keys = new ArrayList<>(rowCountPerTask);
ArrayList<KeyRange> keyRanges = new ArrayList<>(rowCountPerTask);
Set<byte[]> indexRowKeys = new HashSet<>(rowCountPerTask);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A byte array hash set would not work here. The byte array needs to be wrapped with equals and hashCode, or Map<byte[], Put> created with Maps.newTreeMap(Bytes.BYTES_COMPARATOR) can be used instead.

Copy link
Contributor

@kadirozde kadirozde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks very good. I will approve when the hash set issue is fixed. Thanks

@abhishek-chouhan
Copy link
Contributor Author

Sorry for that miss. Have updated to use TreeSet with appropriate comparator @kadirozde and verified the expected behavior.

Copy link
Contributor

@kadirozde kadirozde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

HColumnDescriptor desc = admin.getTableDescriptor(indexTable).getColumnFamilies()[0];
desc.setTimeToLive(1);
admin.modifyColumn(indexTable, desc);
Thread.sleep(1000);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use EEM to advance time instead of sleeping?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modify is async operation, which needs to actually disable/enable regions. Faking a skip in time would not help.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it not sleeping because the test would want to expire the row?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is mainly for the admin action but solves both the things. For majority of the cases the admin operation finishes in 1 sec so the retry loop is skipped altogether.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Why do you need the first sleep for 1s if you're going to loop to wait later anyway?
  2. Why is each sleep so long (2s) rather than something short, like 10 or 100ms?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first sleep was handling both the things of ttl expiry as well as giving reasonable time for most cases of the admin operation to succeed. The alternative is to use edge just for the ttl of 1 second but still have the retries in place since we actually need to wait for the admin operation. No particular reason of having the retry interval large, thought 40 seconds overall for the test should be enough to have it running reasonably deterministic on the most flaky of hardwares. Let me know if you strongly feel about changing these and i can work on them.

rowCount++;
}
} catch (Throwable t) {
ServerUtil.throwIOException(indexHTable.getName().toString(), t);
}
// Check if any expected rows from index(which we didn't get) are already expired due to TTL
// TODO: metrics for expired rows
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please also create a jira for this so that we don't lose it in the comments? Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, will do.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to link it to the code's comment.

Copy link
Contributor

@swaroopak swaroopak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, have some comments. Thanks.

Copy link
Contributor

@kadirozde kadirozde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, Thanks!

@abhishek-chouhan
Copy link
Contributor Author

Thanks for the reviews!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants