-
Notifications
You must be signed in to change notification settings - Fork 275
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
HelixAccountService: limit the number of versions in the list #1252
Conversation
35288a7
to
4684ece
Compare
Codecov Report
@@ Coverage Diff @@
## master #1252 +/- ##
=========================================
Coverage ? 72.28%
Complexity ? 6123
=========================================
Files ? 440
Lines ? 35239
Branches ? 4481
=========================================
Hits ? 25472
Misses ? 8603
Partials ? 1164
Continue to review full report at Codecov.
|
4684ece
to
cb6291d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me after the comments are addressed.
ambry-account/src/main/java/com/github/ambry/account/RouterStore.java
Outdated
Show resolved
Hide resolved
ambry-account/src/main/java/com/github/ambry/account/RouterStore.java
Outdated
Show resolved
Hide resolved
blobIDAndVersionsJson.stream() | ||
.forEach(accountBlobIDInJson -> blobIDAndVersions.add(BlobIDAndVersion.fromJson(accountBlobIDInJson))); | ||
Collections.sort(blobIDAndVersions, Comparator.comparing(BlobIDAndVersion::getVersion)); | ||
BlobIDAndVersion blobIDAndVersion = blobIDAndVersions.get(blobIDAndVersions.size() - 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this piece of code has same logic (correct me if I am wrong) with line106-109. If yes, can we make them consistent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the difference is that one need to sort the list and the other only has to get the latest blobIDAndVersion. I figure it's too small to create a function for.
ambry-account/src/main/java/com/github/ambry/account/RouterStore.java
Outdated
Show resolved
Hide resolved
ambry-api/src/main/java/com.github.ambry/config/HelixAccountServiceConfig.java
Outdated
Show resolved
Hide resolved
ambry-account/src/main/java/com/github/ambry/account/RouterStore.java
Outdated
Show resolved
Hide resolved
ambry-account/src/main/java/com/github/ambry/account/RouterStore.java
Outdated
Show resolved
Hide resolved
ambry-account/src/main/java/com/github/ambry/account/RouterStore.java
Outdated
Show resolved
Hide resolved
iter.remove(); | ||
logger.info("Removing blob " + blobIDAndVersion.getBlobID() + " at version " + blobIDAndVersion.getVersion()); | ||
try { | ||
router.get().deleteBlob(blobIDAndVersion.getBlobID(), SERVICE_ID).get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any edge cases where we would not want to delete the oldest blob from within the update logic.
The main case to consider is probably where the update to zookeeper does not succeed. In this case we would have deleted a blob in ambry that could still exist in the current znode.
However, this may not be a problem if totalNumberOfVersionsToKeep
is sufficiently large that the chance of someone else still interested in reading that blob is very small.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete the blobs after successfully updates zookeeper node.
ambry-api/src/main/java/com.github.ambry/config/HelixAccountServiceConfig.java
Show resolved
Hide resolved
ambry-account/src/main/java/com/github/ambry/account/RouterStore.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just one small comment left
Enforcing a upper bound on how many versions of account metadata to save in the ambry-server.