Skip to content

Commit

Permalink
Fix build due to multiple commits to same file causing compilation fa…
Browse files Browse the repository at this point in the history
…ilure (opensearch-project#13019)

Signed-off-by: Gaurav Bafna <[email protected]>
  • Loading branch information
gbbafna authored and shourya035 committed Apr 17, 2024
1 parent 403e204 commit 8883cd0
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ protected long primaryOperationSize(BulkShardRequest request) {

@Override
public ReplicationMode getReplicationMode(IndexShard indexShard) {
if (indexShard.indexSettings().isRemoteNode()) {
if (indexShard.indexSettings().isAssignedOnRemoteNode()) {
return ReplicationMode.PRIMARY_TERM_VALIDATION;
}
return super.getReplicationMode(indexShard);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ public void performOn(
* @return the overridden replication mode.
*/
public ReplicationMode getReplicationMode(IndexShard indexShard) {
if (indexShard.indexSettings().isRemoteNode()) {
if (indexShard.indexSettings().isAssignedOnRemoteNode()) {
return ReplicationMode.NO_REPLICATION;
}
return ReplicationMode.FULL_REPLICATION;
Expand Down Expand Up @@ -642,7 +642,7 @@ public void handleException(TransportException exp) {
primaryRequest.getPrimaryTerm(),
initialRetryBackoffBound,
retryTimeout,
indexShard.indexSettings().isRemoteNode()
indexShard.indexSettings().isAssignedOnRemoteNode()
? new ReplicationModeAwareProxy<>(
getReplicationMode(indexShard),
clusterState.getNodes(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ protected void shardOperationOnReplica(Request shardRequest, IndexShard replica,
private void maybeSyncTranslog(final IndexShard indexShard) throws IOException {
if (indexShard.getTranslogDurability() == Translog.Durability.REQUEST
&& indexShard.getLastSyncedGlobalCheckpoint() < indexShard.getLastKnownGlobalCheckpoint()
&& indexShard.indexSettings().isRemoteNode() == false) {
&& indexShard.indexSettings().isAssignedOnRemoteNode() == false) {
indexShard.sync();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1380,7 +1380,8 @@ private void addPeerRecoveryRetentionLeaseForSolePrimary() {
final ShardRouting primaryShard = routingTable.primaryShard();
final String leaseId = getPeerRecoveryRetentionLeaseId(primaryShard);
if (retentionLeases.get(leaseId) == null) {
if (replicationGroup.getReplicationTargets().equals(Collections.singletonList(primaryShard)) || indexSettings.isRemoteNode()) {
if (replicationGroup.getReplicationTargets().equals(Collections.singletonList(primaryShard))
|| indexSettings.isAssignedOnRemoteNode()) {
assert primaryShard.allocationId().getId().equals(shardAllocationId) : routingTable.assignedShards()
+ " vs "
+ shardAllocationId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected boolean performAfterRefreshWithPermit(boolean didRefresh) {
if (didRefresh
&& shard.state() == IndexShardState.STARTED
&& shard.getReplicationTracker().isPrimaryMode()
&& shard.indexSettings.isRemoteNode() == false) {
&& shard.indexSettings.isAssignedOnRemoteNode() == false) {
publisher.publish(shard, shard.getLatestReplicationCheckpoint());
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3535,8 +3535,8 @@ public void updateGlobalCheckpointOnReplica(final long globalCheckpoint, final S
* When remote translog is enabled for an index, replication operation is limited to primary term validation and does not
* update local checkpoint at replica, so the local checkpoint at replica can be less than globalCheckpoint.
*/
assert (state() != IndexShardState.POST_RECOVERY && state() != IndexShardState.STARTED) || indexSettings.isRemoteNode()
: "supposedly in-sync shard copy received a global checkpoint ["
assert (state() != IndexShardState.POST_RECOVERY && state() != IndexShardState.STARTED)
|| indexSettings.isAssignedOnRemoteNode() : "supposedly in-sync shard copy received a global checkpoint ["
+ globalCheckpoint
+ "] "
+ "that is higher than its local checkpoint ["
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public SegmentReplicationSourceFactory(
}

public SegmentReplicationSource get(IndexShard shard) {
if (shard.indexSettings().isRemoteNode()) {
if (shard.indexSettings().isAssignedOnRemoteNode()) {
return new RemoteStoreReplicationSource(shard);
} else {
return new PrimaryShardReplicationSource(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ protected void doExecute(Task task, PublishCheckpointRequest request, ActionList

@Override
public ReplicationMode getReplicationMode(IndexShard indexShard) {
if (indexShard.indexSettings().isRemoteNode()) {
if (indexShard.indexSettings().isAssignedOnRemoteNode()) {
return ReplicationMode.FULL_REPLICATION;
}
return super.getReplicationMode(indexShard);
Expand Down Expand Up @@ -201,7 +201,7 @@ protected void shardOperationOnReplica(PublishCheckpointRequest request, IndexSh
logger.trace(() -> new ParameterizedMessage("Checkpoint {} received on replica {}", request, replica.shardId()));
// Condition for ensuring that we ignore Segrep checkpoints received on Docrep shard copies.
// This case will hit iff the replica hosting node is not remote enabled and replication type != SEGMENT
if (replica.indexSettings().isRemoteNode() == false && replica.indexSettings().isSegRepLocalEnabled() == false) {
if (replica.indexSettings().isAssignedOnRemoteNode() == false && replica.indexSettings().isSegRepLocalEnabled() == false) {
logger.trace("Received segrep checkpoint on a docrep shard copy during an ongoing remote migration. NoOp.");
return new ReplicaResult();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,13 +344,13 @@ public synchronized void startAll() throws IOException {

public synchronized DiscoveryNodes generateFakeDiscoveryNodes() {
DiscoveryNodes.Builder builder = new DiscoveryNodes.Builder();
if (primary.indexSettings() != null && primary.indexSettings().isRemoteNode()) {
if (primary.indexSettings() != null && primary.indexSettings().isAssignedOnRemoteNode()) {
builder.add(IndexShardTestUtils.getFakeRemoteEnabledNode(primary.routingEntry().currentNodeId()));
} else {
builder.add(IndexShardTestUtils.getFakeDiscoNode(primary.routingEntry().currentNodeId()));
}
for (IndexShard replica : replicas) {
if (replica.indexSettings() != null && replica.indexSettings().isRemoteNode()) {
if (replica.indexSettings() != null && replica.indexSettings().isAssignedOnRemoteNode()) {
builder.add(IndexShardTestUtils.getFakeRemoteEnabledNode(replica.routingEntry().currentNodeId()));
} else {
builder.add(IndexShardTestUtils.getFakeDiscoNode(replica.routingEntry().currentNodeId()));
Expand Down

0 comments on commit 8883cd0

Please sign in to comment.