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

Split the pr to support named blob ttl update only #2542

Merged
merged 4 commits into from
Aug 18, 2023

Conversation

SophieGuo410
Copy link
Contributor

No description provided.

@SophieGuo410 SophieGuo410 force-pushed the Branch_named_blob_update_ttl_support branch from 7737676 to 90d2f5c Compare August 17, 2023 18:46
@codecov-commenter
Copy link

codecov-commenter commented Aug 17, 2023

Codecov Report

Patch coverage: 20.00% and project coverage change: +20.55% 🎉

Comparison is base (1307007) 33.05% compared to head (8b70ca8) 53.61%.
Report is 2 commits behind head on master.

Additional details and impacted files
@@              Coverage Diff              @@
##             master    #2542       +/-   ##
=============================================
+ Coverage     33.05%   53.61%   +20.55%     
- Complexity     4428     7642     +3214     
=============================================
  Files           794      801        +7     
  Lines         63782    63947      +165     
  Branches       7793     7801        +8     
=============================================
+ Hits          21086    34284    +13198     
+ Misses        40479    26669    -13810     
- Partials       2217     2994      +777     
Files Changed Coverage Δ
.../main/java/com/github/ambry/named/NamedBlobDb.java 100.00% <ø> (+100.00%) ⬆️
...n/java/com/github/ambry/named/NamedBlobRecord.java 66.66% <0.00%> (+66.66%) ⬆️
...com/github/ambry/frontend/NamedBlobPutHandler.java 23.39% <0.00%> (+23.39%) ⬆️
...b/ambry/tools/perf/NamedBlobMysqlDatabasePerf.java 0.00% <0.00%> (ø)
.../java/com/github/ambry/named/MySqlNamedBlobDb.java 84.76% <100.00%> (+84.76%) ⬆️

... and 304 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@SophieGuo410 SophieGuo410 force-pushed the Branch_named_blob_update_ttl_support branch from 89b2550 to 90af4af Compare August 17, 2023 19:46
@SophieGuo410 SophieGuo410 force-pushed the Branch_named_blob_update_ttl_support branch from 67fdd8d to a6b696c Compare August 17, 2023 22:15
Copy link
Contributor

@mikeyang923 mikeyang923 left a comment

Choose a reason for hiding this comment

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

🚀

@@ -764,6 +764,30 @@ private void applySoftDelete(short accountId, short containerId, String blobName
}
}

@Override
public CompletableFuture<PutResult> ttlUpdate(NamedBlobRecord record, NamedBlobState state) {
Copy link
Collaborator

@justinlin-linkedin justinlin-linkedin Aug 18, 2023

Choose a reason for hiding this comment

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

can we have a dedicated sql statement for updating ttl. And there should be some limitation to when a named blob's ttl can be updated, like if there is an expiration date, it needs to be more than one day. We should share the same configuration with what is in the server nodes. Maybe we can leave this logic out side of mysql database and have it in the http request handler?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As we discussed offline, I think I can re-use this updateBlobStateToReady method, just change the name to updateBlobTtlAndStateToReady to be more clear.
And in covertId logic, when operation is TTL_UPDATE, we just get the named blob for id and version.

conversionFuture = getNamedBlobDb().get(namedBlobPath.getAccountName(), namedBlobPath.getContainerName(), namedBlobPath.getBlobName(), getOption).thenApply(result -> { restRequest.setArg(RestUtils.InternalKeys.NAMED_BLOB_VERSION, result.getInsertedRecord().getVersion()); restRequest.setArg(RestUtils.InternalKeys.NAMED_BLOB_MAPPED_ID, result.getInsertedRecord().getBlobId()); return result.getInsertedRecord().getBlobId(); });

And in ttlUpdateHanlder -> routerCallback we can directly call this method. updateBlobTtlAndStateToReady with the blobId and Version updated in the newNamedBlobRecord.
NamedBlobRecord record = new NamedBlobRecord(namedBlobPath.getAccountName(), namedBlobPath.getContainerName(), namedBlobPath.getBlobName(), (String) restRequest.getArgs().get(NAMED_BLOB_MAPPED_ID), Utils.Infinite_Time, namedBlobVersion); namedBlobDb.updateBlobStateToReady(record).get();

@SophieGuo410 SophieGuo410 force-pushed the Branch_named_blob_update_ttl_support branch from be3d55b to 8b70ca8 Compare August 18, 2023 19:43
@SophieGuo410 SophieGuo410 merged commit 71e861f into master Aug 18, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants