-
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
Implement Offline-To-Bootstrap state transition in StorageManager #1326
Implement Offline-To-Bootstrap state transition in StorageManager #1326
Conversation
jsjtzyy
commented
Nov 30, 2019
•
edited
Loading
edited
- implemented Offline-To-Bootstrap logic in storage manager
- introduced State Transition Exception and Transition Error Code
- introduced bootstrap-in-progress file to determine if a store is new added and still in bootstrap process
- added a config to switch on/off state change listeners in partition state model
Codecov Report
@@ Coverage Diff @@
## master #1326 +/- ##
=========================================
Coverage ? 72.19%
Complexity ? 6496
=========================================
Files ? 471
Lines ? 37220
Branches ? 4696
=========================================
Hits ? 26871
Misses ? 9108
Partials ? 1241
Continue to review full report at Codecov.
|
07de3a1
to
0a605eb
Compare
This changes integrates replica state transition logic with server regular startup. For new added replica, state transition should perform some bootstrap work. For existing replicas, their regular startup won't be affected.
0a605eb
to
12f625a
Compare
import org.apache.helix.store.zk.ZkHelixPropertyStore; | ||
|
||
|
||
public class MockHelixManagerFactory extends HelixFactory { |
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.
I moved MockHelixManagerFactory
out of HelixParticipantTest.java
. No specific change in this file. (This single file contributes 426 lines and changes in rest files should be less than 600 lines, which is not hard to review)
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.
Initial comments added.
ambry-api/src/main/java/com.github.ambry/server/StateModelListenerType.java
Outdated
Show resolved
Hide resolved
ambry-api/src/main/java/com.github.ambry/server/StateModelListenerType.java
Outdated
Show resolved
Hide resolved
ambry-api/src/main/java/com.github.ambry/server/StateTransitionException.java
Outdated
Show resolved
Hide resolved
ambry-api/src/main/java/com.github.ambry/server/TransitionErrorCode.java
Outdated
Show resolved
Hide resolved
ambry-store/src/main/java/com.github.ambry.store/BlobStore.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.
a couple of minor comments. Looks good to me otherwise.
@@ -43,25 +43,26 @@ | |||
/** | |||
* An implementation of {@link ClusterParticipant} that registers as a participant to a Helix cluster. | |||
*/ | |||
class HelixParticipant implements ClusterParticipant, PartitionStateChangeListener { | |||
private final Logger logger = LoggerFactory.getLogger(getClass()); | |||
public class HelixParticipant implements ClusterParticipant, PartitionStateChangeListener { | |||
private final String clusterName; | |||
private final String zkConnectStr; | |||
private final HelixFactory helixFactory; |
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.
MINOR: since we are already in this file, looks like helixfactory is not being used. We can remove it.
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.
right, removed.
public void onPartitionStateChangeToStandbyFromLeader(String partitionName) { | ||
for (PartitionStateChangeListener partitionStateChangeListener : partitionStateChangeListeners) { | ||
partitionStateChangeListener.onPartitionStateChangeToStandbyFromLeader(partitionName); | ||
public void onPartitionBecomeStandbyFromLeader(String partitionName) { |
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.
MINOR:
maybe we can replace this by
if(partitionstateChangeListeners.containsKey(StateModelListenerType.CloudToStoreReplicationManagerListener) {
partitionStateChangeListeners.get(StateModelListenerType.CloudToStoreReplicationManagerListener).onPartitionBecomeStandbyFromLeader(partitionName)
}
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.
Appreciate your suggestion but I feel like it loses a little bit of readability. What do you think?
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