-
Notifications
You must be signed in to change notification settings - Fork 0
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
Dual Replication - Primary changes #152
Conversation
@@ -5199,6 +5209,10 @@ public AsyncIOProcessor<Translog.Location> getTranslogSyncProcessor() { | |||
return translogSyncProcessor; | |||
} | |||
|
|||
public boolean ongoingEngineMigration() { | |||
return RemoteStoreUtils.isMigrationDirectionSet(clusterService) == 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.
This will return true for all the shards during migration . Will that have any side effects ?
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 this altogether from IndexShard
&& !shard.indexSettings.isSegRepWithRemoteEnabled() | ||
/* | ||
During remote store migration, the isSegRepWithRemoteEnabled criteria would return false | ||
since we do not alter the remote store based index settings at that stage. Explicitly | ||
blocking checkpoint publication from this refresh listener since it ends up interfering | ||
with the RemoteStoreRefreshListener invocation | ||
*/ | ||
&& !shard.ongoingEngineMigration()) { |
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 we have isSegRepLocalEnabled
instead of negative checks ?
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.
Addressed this. Changed the isSegRepLocalEnabled
check to ensure that the Checkpoint listeners won't be registered if the node is non-remote
@@ -1248,7 +1254,8 @@ private void createReplicationLagTimers() { | |||
if (cps.inSync | |||
&& replicationGroup.getUnavailableInSyncShards().contains(allocationId) == false | |||
&& isPrimaryRelocation(allocationId) == false | |||
&& latestReplicationCheckpoint.isAheadOf(cps.visibleReplicationCheckpoint)) { | |||
&& latestReplicationCheckpoint.isAheadOf(cps.visibleReplicationCheckpoint) | |||
&& (ongoingEngineMigration && routingTable.getByAllocationId(allocationId).isAssignedToRemoteStoreNode() == 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 do we need ongoingEngineMigration
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.
Removed this. Relying on the shardRouting and isSegRepLocalEnabled
check to ensure that the timers are only created if:
- The shard copy is hosted on a remote enabled node
- The index setting has segrep enabled but remote disabled (vanilla segrep)
@@ -1096,4 +1098,14 @@ enum IndexRemovalReason { | |||
REOPENED, | |||
} | |||
} | |||
|
|||
private void updateShardRoutingWithNode(IndexShardRoutingTable indexShardRoutingTable, DiscoveryNodes nodes) { |
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.
what about createShard
flow ?
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.
Addressing that
@@ -75,6 +75,7 @@ public class ShardRouting implements Writeable, ToXContentObject { | |||
private final long expectedShardSize; | |||
@Nullable | |||
private final ShardRouting targetRelocatingShard; | |||
private boolean assignedToRemoteStoreNode; |
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 is not populated by master and only data node . Is it intentional ? If yes, should we make it Boolean
instead ? Also it is final .
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.
Ideally we don't want to serialize the value for this field since this won't be used anywhere else. I have changed this to Boolean
instead of the primitive type, but I have assigned a default value to prevent any possible NPEs when the shardRouting entry sent from the cluster manager nodes are serialized on the data node.
// If the current routing is the primary, then it does not need to be replicated | ||
if (shardRouting.isSameAllocation(primaryRouting)) { | ||
return ReplicationMode.NO_REPLICATION; | ||
} | ||
|
||
// Perform full replication during primary failover |
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.
primary relocation.
5dbae4f
to
7d9f9cd
Compare
463eb84
to
77c9b3a
Compare
7d9f9cd
to
791e2da
Compare
@@ -642,7 +642,7 @@ public void handleException(TransportException exp) { | |||
primaryRequest.getPrimaryTerm(), | |||
initialRetryBackoffBound, | |||
retryTimeout, | |||
indexShard.isRemoteTranslogEnabled() | |||
indexShard.isRemoteTranslogEnabled() || indexShard.indexSettings().isRemoteNode() |
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.
Lets subsume the check of indexShard.indexSettings().isRemoteNode()
inside the indexShard.isRemoteTranslogEnabled()
check itself?
@@ -1089,10 +1089,6 @@ private ReplicationGroup calculateReplicationGroup() { | |||
newVersion = replicationGroup.getVersion() + 1; | |||
} | |||
|
|||
assert indexSettings().isRemoteTranslogStoreEnabled() |
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.
Lets not remove this assertion. Removing this can pose risks to bugs.
We can check first if index is remote enabled, or if there is an inflight migration, or all tracked shards are replicated.
&& latestReplicationCheckpoint.isAheadOf(cps.visibleReplicationCheckpoint) | ||
/* | ||
Handle remote store migration cases. Replication Lag timers would be created if the node on which primary is hosted is either: | ||
- Segrep enabled without remote store | ||
- Destination replica shard is hosted on a remote store enabled node (Remote store enabled nodes have segrep enabled implicitly) | ||
*/ | ||
&& (indexSettings.isSegRepLocalEnabled() == true | ||
|| routingTable.getByAllocationId(allocationId).isAssignedToRemoteStoreNode() == 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.
Not really clear on why is this being added?
- If remote translog is enabled, then returns true if given allocation id matches the primary or it's relocation target allocation primary and primary target allocation id. | ||
- During an ongoing remote migration, the above-mentioned checks are considered when the shard is assigned to a remote store backed node | ||
*/ | ||
if (indexSettings().isRemoteTranslogStoreEnabled() || assignedToRemoteStoreNode == true) { | ||
return (allocationId.equals(primaryAllocationId) || allocationId.equals(primaryTargetAllocationId)); |
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 we return false if the if condition holds true since the remote translogs would anyways be downloaded on the relocating primary?
if (RemoteStoreUtils.isMigrationDirectionSet(clusterService)) { | ||
return ReplicationMode.FULL_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.
Why do we need it on shards that are on remote store already?
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 question applicable for other actions as well.
@@ -3328,7 +3333,7 @@ public void syncRetentionLeases() { | |||
) | |||
); | |||
} else { | |||
logger.trace("background syncing retention leases [{}] after expiration check", retentionLeases.v2()); | |||
logger.info("background syncing retention leases [{}] after expiration check", retentionLeases.v2()); |
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.
do we need this with info level?
// Explicitly disable search idle during remote store migration | ||
if (RemoteStoreUtils.isMigrationDirectionSet(clusterService)) { | ||
return 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.
Curious on why is this required?
@@ -340,7 +340,7 @@ private void onSuccessfulSegmentsSync( | |||
resetBackOffDelayIterator(); | |||
// Set the minimum sequence number for keeping translog | |||
indexShard.getEngine().translogManager().setMinSeqNoToKeep(lastRefreshedCheckpoint + 1); | |||
// Publishing the new checkpoint which is used for remote store + segrep indexes | |||
// Publishing the new checkpoint which is used for remote store + segrep indexess |
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.
lets remove this unintended change?
DiscoveryNode targetNode = nodes.getLocalNode(); | ||
// Set remote attributes on Shard routing if the target node for the shards has remote attributes | ||
if (targetNode.isRemoteStoreNode()) { | ||
shardRouting.setAssignedToRemoteStoreNode(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.
appears to be error prone, is there a way to have this as final and set inside ctor?
@@ -1096,4 +1102,14 @@ enum IndexRemovalReason { | |||
REOPENED, | |||
} | |||
} | |||
|
|||
private void updateShardRoutingWithNode(IndexShardRoutingTable indexShardRoutingTable, DiscoveryNodes nodes) { |
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 there a way this can be done within ctor only?
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.
Left some comments, please take a look at them.
68e9d38
to
2a828e5
Compare
f32ee23
to
561375c
Compare
cf5dc23
to
5601758
Compare
Signed-off-by: Shourya Dutta Biswas <[email protected]>
Signed-off-by: Shourya Dutta Biswas <[email protected]>
Signed-off-by: Shourya Dutta Biswas <[email protected]>
561375c
to
d3ada3a
Compare
Description
[Describe what this change achieves]
Related Issues
Resolves #[Issue number to be closed when this PR is merged]
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.