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

Added DeleteManager and DeleteOperation. #239

Merged
merged 9 commits into from
Apr 29, 2016

Conversation

xiahome
Copy link
Contributor

@xiahome xiahome commented Mar 16, 2016

Patch for DeleteManager and DeleteOperation:

Some improvements and fixes for DeleteManager

  1. merged the PutManagerpatch into DeleteManager patch.
  2. added more test cases for completeness.
  3. made delete operation be complied with operation tracker. If operation track decides the operation has been completed, no need to wait for more responses (especially for Blob_Not_Found).
  4. added to SimpleOperationTracker to disable shuffling replicas to make deterministic processing order for replica responses.
  5. modified part of code in PutManager for testing purpose (MockServerLayout and MockServer)
  6. resolved conflicts between Put and Delete managers
  7. solved router close issue in test (exception causes router to close during operation)
  8. complied with any changes made in the NonBlockingRouter
  9. improved documentation

Test coverage:

  1. DeleteManager: 97.6%
  2. DeleteOperation: 86.8% (uncovered part is for some not-like-to-happen cases. We have the code just for confidence and robustness)
  3. RouterUtils: 91.7%

Test done: ./gradlew build

Reviewer: Priyesh, Siva

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.
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

is this addressed ?

Copy link
Contributor Author

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%.
this.routerConfig = routerConfig;
this.routerMetrics = routerMetrics;
this.time = time;
deleteOperations = new HashSet<DeleteOperation>();
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 concurrentHashSet as we have in PutManager? both Put qps and delete qps are pretty similar. So, why not follow same in both

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 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.

Copy link
Contributor

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()

Copy link
Contributor Author

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);
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

@nsivabalan
Copy link
Contributor

Done with my pass

@pnarayanan
Copy link
Contributor

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.

assertEquals("RouterErrorCode should be BlobDoesNotExist", expectedRouterErrorCode,
((RouterException) e.getCause()).getErrorCode());
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

new line

Copy link
Contributor Author

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?

@xiahome xiahome force-pushed the deleteManagerPatch branch 2 times, most recently from 916e5a2 to 8fddd35 Compare April 29, 2016 06:33
@@ -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}.
Copy link
Contributor

Choose a reason for hiding this comment

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

typo "different"

@nsivabalan
Copy link
Contributor

Looks good. Have you applied code styling? and build succeeded? Also, can you squash all the commits.

@vgkholla
Copy link
Contributor

@nsivabalan I thought we were squashing when merging now?

@nsivabalan
Copy link
Contributor

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.

@pnarayanan
Copy link
Contributor

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.

@vgkholla
Copy link
Contributor

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.

@nsivabalan
Copy link
Contributor

ok, got you. My bad. I forgot. So, can I go ahead with the merge then ?

@vgkholla
Copy link
Contributor

Once he confirms the formatting and build :)

@pnarayanan
Copy link
Contributor

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.

@pnarayanan
Copy link
Contributor

@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.

@vgkholla
Copy link
Contributor

vgkholla commented Apr 29, 2016

+1 I find commit messages most useful when they are of this format

<short message describing your change - less than 80 chars>
< empty line>
< a little longer description of the change (max 3 - 4 lines)>

EDIT: Some better articles on writing good commit messages
https://github.com/erlang/otp/wiki/Writing-good-commit-messages
http://chris.beams.io/posts/git-commit/

They recommend the long description to completely explain the change and the short description to be < 50 chars.

@nsivabalan
Copy link
Contributor

Fine. I am going ahead with the merge. Synced up with Ming offline wrt build and styling

@nsivabalan nsivabalan merged commit 6f18cae into linkedin:master Apr 29, 2016
@xiahome xiahome deleted the deleteManagerPatch branch May 25, 2016 22:53
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.

None yet

4 participants