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

Add undelete method to BlobStore #1373

Merged
merged 7 commits into from
Feb 10, 2020

Conversation

justinlin-linkedin
Copy link
Collaborator

Adding undelete method to blobstore and other Store implementation.
This PR will have no change w.r.t AmbryRequests.

@codecov-io
Copy link

codecov-io commented Feb 5, 2020

Codecov Report

Merging #1373 into master will increase coverage by 0.05%.
The diff coverage is 70%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1373      +/-   ##
============================================
+ Coverage     72.01%   72.06%   +0.05%     
- Complexity     6779     6791      +12     
============================================
  Files           488      488              
  Lines         38445    38504      +59     
  Branches       4890     4898       +8     
============================================
+ Hits          27685    27747      +62     
  Misses         9421     9421              
+ Partials       1339     1336       -3
Impacted Files Coverage Δ Complexity Δ
...in/java/com.github.ambry.cloud/CloudBlobStore.java 81.05% <0%> (-0.29%) 81 <0> (ø)
...main/java/com.github.ambry.store/StoreMetrics.java 97.26% <100%> (+0.05%) 10 <0> (ø) ⬇️
...n/java/com.github.ambry.store/PersistentIndex.java 89.15% <100%> (+0.22%) 244 <1> (+2) ⬆️
...ithub.ambry.commons/LoggingNotificationSystem.java 45.16% <12.5%> (-13.18%) 9 <1> (ø)
...rc/main/java/com.github.ambry.store/BlobStore.java 89.06% <78.72%> (-0.65%) 107 <3> (+5)
...java/com.github.ambry.store/CompactionManager.java 89.88% <0%> (-2.39%) 25% <0%> (ø)
...ain/java/com.github.ambry.router/PutOperation.java 91.73% <0%> (+0.49%) 115% <0%> (+1%) ⬆️
...c/main/java/com.github.ambry.network/Selector.java 79% <0%> (+0.78%) 78% <0%> (+1%) ⬆️
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update adc32f9...60e973c. Read the comment docs.

Copy link
Contributor

@jsjtzyy jsjtzyy left a comment

Choose a reason for hiding this comment

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

Initial comments, will take a second look.

* @param info The {@link MessageInfo} that carries some basic information about this operation.
* @return the lifeVersion of the undeleted blob.
*/
short undelete(MessageInfo info) throws StoreException;
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason why we don't pass in MessageWriteSet? Is this because we undelete only one blob at a time?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

MessgeWriteSet includes a serialized undelete record, which will be persisted on disk in the log. The problem is that this serialized record requires a lifeVersion, but we don't know the lifeVersion before we query the index. So here I pass a MessageInfo instead of MessageWriteSet. You can see in the BlobStore.undelete method, I create a MessageWriteSet in the end, with a lifeVersion.

StoreKey id = info.getStoreKey();
Offset indexEndOffsetBeforeCheck = index.getCurrentEndOffset();
List<IndexValue> values = index.findAllIndexValuesForKey(id, null);
index.validateSanityForUndelete(id, values, IndexValue.LIFE_VERSION_FROM_FRONTEND);
Copy link
Contributor

Choose a reason for hiding this comment

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

Note that, other methods (put, ttlUpdate, delete) in BlobStore are also invoked in Replication. When you implement undelete replication part, the LIFE_VERSION_FROM_FRONTEND check here probably needs to change.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I actually have to change ttlupdate and delete later to make them aware of undelete in replication.

Copy link
Contributor

@jsjtzyy jsjtzyy left a comment

Choose a reason for hiding this comment

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

LGTM, one minor comment.

Copy link
Contributor

@zzmao zzmao left a comment

Choose a reason for hiding this comment

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

LGTM.

One minor comment.

@zzmao zzmao merged commit efc5d89 into linkedin:master Feb 10, 2020
@justinlin-linkedin justinlin-linkedin deleted the undelete/blobstore branch February 10, 2020 19:04
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.

5 participants