-
Notifications
You must be signed in to change notification settings - Fork 274
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
Added DeleteManager and DeleteOperation. #239
Conversation
1. Added DeleteManager and DeleteOperation for non-blocking router; 2. Added Unit tests for these. 3. Modified MockServer for the test. Will later resolve Put patch and resolve conflicts. 4. The code largely follows PutManager and PutOperation, please refer to those for review. 5. This is an initial patch subject to further modifications and change merging with Put. To save your time please check at high level. 6. Log and metrics not included yet. Will work them out together with Put part. Test done: ./gradlew build Test coverage: DeleteManager: 84.2% (due to close() method not tested), DeleteOperation: 89.8% Reviewer: Priyesh, Siva, Gopal
routerPutRequestParallelism = verifiableProperties.getInt("router.put.request.parallelism", 3); | ||
routerPutSuccessTarget = verifiableProperties.getInt("router.put.success.target", 2); | ||
// @todo Verify the numbers here. In coordinator the policy for delete operation is to issue requests to | ||
// @todo all replicas. This also need to be hard coded to 12 if lsg is counted. |
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.
please don't write any comments that contain internal details.
As for the todo, we can always configure accordingly no matter what the default is.
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.
Thanks for this suggestion. Will remove all internal details.
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.
is this addressed ?
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.
Now addressed, thanks this was missed in the previous commit.
Tried to largely follow some logic as used in Put (after the new patch). I do see there is common parts between Put and Delete, so will take offline discussion to see if it is reasonable to make some abstract classes. Test coverage: DeleteManager: 97.6%, DeleteOperation: 90.2% (due to rare exceptions), RouterUtils: 91.7%.
bfa6e20
to
66159f2
Compare
this.routerConfig = routerConfig; | ||
this.routerMetrics = routerMetrics; | ||
this.time = time; | ||
deleteOperations = new HashSet<DeleteOperation>(); |
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.
Why not concurrentHashSet as we have in PutManager? both Put qps and delete qps are pretty similar. So, why not follow same in both
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 reason for using a HashSet
is that, this set will only be accessed by the OperationController
thread that owns the DeleteManager
. However it will make sense to use a ConcurrentHashSet
for two reasons: 1) be consistent with the PutManager
, 2) for our confidence in synchronization issue. Let me know if you agree on this.
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.
This will have to be a concurrent hash set (which is why it is one in PutManager
). Entries get added to this set concurrently and in the context of the calling threads of the router library (not the OperationController
). The flow would be router.deleteBlob()
-> deleteManager.submitDeleteOperation()
-> deleteOperations.add()
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.
@pnarayanan makes sense, thank you. I will make the change.
mockSelectorState = new AtomicReference<MockSelectorState>(MockSelectorState.Good); | ||
clusterMap = new MockClusterMap(); | ||
serverLayout = new MockServerLayout(clusterMap); | ||
setServerResponse(true); |
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.
why can't we set this value to true in constructor(of MockServer) and not set it everytime. We should set it only for exceptional cases i.e for failure cases
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.
There are two tests that need this specifically set false
.
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.
Removed.
Done with my pass |
Looks good. Siva, once you finish, let me know (or go ahead and merge using the squash and merge option and editing the commit log to avoid irrelevant commit messages). Let us push this in by tomorrow. |
9bfb558
to
b4626a0
Compare
assertEquals("RouterErrorCode should be BlobDoesNotExist", expectedRouterErrorCode, | ||
((RouterException) e.getCause()).getErrorCode()); | ||
} | ||
} | ||
} |
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.
new line
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.
@nsivabalan Do you mean to add a new line?
916e5a2
to
8fddd35
Compare
@@ -170,27 +153,30 @@ public void testBlobExpired() | |||
} | |||
|
|||
/** | |||
* Test the case when the blob cannot be found in store servers. | |||
* Test if the {@link RouterErrorCode} is as expected for differe {@link ServerErrorCode}. |
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.
typo "different"
8fddd35
to
18e6472
Compare
Looks good. Have you applied code styling? and build succeeded? Also, can you squash all the commits. |
@nsivabalan I thought we were squashing when merging now? |
Its causing the commit history to differ in our repo and linkedin master. We can get away with it with some additional steps. But I felt if we can squash by ourselves, it solves the problem easily. |
Let us not squash ourselves. Could we hold on? The commit history should not differ if we abandon the branch used for the pull request. |
We should take this offline but as I emailed the other day, you shouldn't be working on your master. @xiahome has this on a branch - his commit history will be fine. We should all be working on branches. The second reason for squash and merge: Even if we squash manually, if we don't use the squash and merge option there will be a commit in the main repository's commit history that says "Merged by X", which we don't want either. We have to use the squash and merge option. |
ok, got you. My bad. I forgot. So, can I go ahead with the merge then ? |
Once he confirms the formatting and build :) |
Also make sure to remove irrelevant lines from the commit message when you do the squash and merge. You would usually need just the original commit's message, though it can happen that certain subsequent commits were for added features. |
@xiahome Do you add the whole PR information into the commit message? Let us avoid that and keep the message short. The message anyway has a reference to the PR number. @nsivabalan when you squash and merge, I think you only need to use the first message for this one. |
+1 I find commit messages most useful when they are of this format <short message describing your change - less than 80 chars> EDIT: Some better articles on writing good commit messages They recommend the long description to completely explain the change and the short description to be < 50 chars. |
Fine. I am going ahead with the merge. Synced up with Ming offline wrt build and styling |
Patch for
DeleteManager
andDeleteOperation
:Some improvements and fixes for
DeleteManager
PutManager
patch intoDeleteManager
patch.Blob_Not_Found
).SimpleOperationTracker
to disable shuffling replicas to make deterministic processing order for replica responses.PutManager
for testing purpose (MockServerLayout
andMockServer
)NonBlockingRouter
Test coverage:
Test done: ./gradlew build
Reviewer: Priyesh, Siva