-
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
Vcrrequest init error fix #1275
Conversation
f68088a
to
c658742
Compare
Codecov Report
@@ Coverage Diff @@
## master #1275 +/- ##
============================================
+ Coverage 72.1% 72.17% +0.07%
- Complexity 6234 6237 +3
============================================
Files 449 449
Lines 35737 35733 -4
Branches 4540 4537 -3
============================================
+ Hits 25769 25792 +23
+ Misses 8791 8764 -27
Partials 1177 1177
Continue to review full report at Codecov.
|
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.
Logic looks good. Few style comments to address.
partitionToReplica.put(partitionId, new CloudReplica(partitionId, currentNode)); | ||
} | ||
return partitionToReplica; | ||
} |
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.
Can simplify this to:
return partitionIds.stream().collect(Collectors.toMap(Function.identity(), partitionId -> new CloudReplica(partitionId, currentNode)));
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.
fixed.
for (ReplicaId replicaId : localReplicaIds) { | ||
partitionToReplica.put(replicaId.getPartitionId(), replicaId); | ||
} | ||
return partitionToReplica; |
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.
Same here.
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.
fixed.
CloudBlobStore store = null; | ||
try { | ||
store = new CloudBlobStore(properties, partitionId, cloudDestination, clusterMap, vcrMetrics); | ||
store.start(); |
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.
We should avoid side effects like starting a store inside a computeIfAbsent lambda.
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.
fixed.
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.
Add a log after `CloudBlobStore created successfully?
One minor comment. LGTM. |
@@ -67,8 +65,8 @@ public boolean shutdownBlobStore(PartitionId id) { | |||
|
|||
@Override | |||
public Store getStore(PartitionId id) { | |||
Store store = partitionToStore.get(id); | |||
return (store != null && store.isStarted()) ? store : null; | |||
createAndStartBlobStoreIfAbsent(id); |
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.
As discussed offline, let's consider the calls to shutdownBlobStore and removeStore in VCR replication
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.
As a fix i have made the CloudBlobStore operations thread safe. Both removestore and shutdownstore are there as is in the add/remove replica flow. But a getstore will return null, if the store is not started.
…lication path (via add/remove paritition) as well as requests path (getStore will add store for vcr if not found).
This PR fixes a bug that was encountered while testing recovery. Vcr was trying to get local replicas map using the "getReplicaIds" API in HelixClusterManager. But this API has a check for being called only in a AmbryDataNode.
As a fix this PR overrides the get local replicas functionality in VcrRequests. Also Vcr nodes should be able to handle requests for all partitions. The overridden get local replicas functionality exhibits this behavior too.