-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initialize the leaderCheckpoint with follower shard's localCheckpoint (…
…#904) (#952) Signed-off-by: Ankit Kala <[email protected]>
- Loading branch information
Showing
6 changed files
with
139 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...st/kotlin/com/amazon/elasticsearch/replication/integ/rest/ReplicationStopThenRestartIT.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.amazon.elasticsearch.replication.integ.rest | ||
|
||
import com.amazon.elasticsearch.replication.MultiClusterRestTestCase | ||
import com.amazon.elasticsearch.replication.MultiClusterAnnotations | ||
import com.amazon.elasticsearch.replication.StartReplicationRequest | ||
import com.amazon.elasticsearch.replication.startReplication | ||
import com.amazon.elasticsearch.replication.stopReplication | ||
import org.assertj.core.api.Assertions | ||
import org.elasticsearch.client.RequestOptions | ||
import org.elasticsearch.client.indices.CreateIndexRequest | ||
import org.junit.Assert | ||
import java.util.concurrent.TimeUnit | ||
|
||
|
||
@MultiClusterAnnotations.ClusterConfigurations( | ||
MultiClusterAnnotations.ClusterConfiguration(clusterName = LEADER), | ||
MultiClusterAnnotations.ClusterConfiguration(clusterName = FOLLOWER) | ||
) | ||
|
||
class ReplicationStopThenRestartIT : MultiClusterRestTestCase() { | ||
private val leaderIndexName = "leader_index" | ||
private val followerIndexName = "follower_index" | ||
|
||
fun `test replication works after unclean stop and start`() { | ||
val followerClient = getClientForCluster(FOLLOWER) | ||
val leaderClient = getClientForCluster(LEADER) | ||
changeTemplate(LEADER) | ||
createConnectionBetweenClusters(FOLLOWER, LEADER) | ||
val createIndexResponse = leaderClient.indices().create(CreateIndexRequest(leaderIndexName), RequestOptions.DEFAULT) | ||
Assertions.assertThat(createIndexResponse.isAcknowledged).isTrue() | ||
followerClient.startReplication(StartReplicationRequest("source", leaderIndexName, followerIndexName)) | ||
insertDocToIndex(LEADER, "1", "dummy data 1",leaderIndexName) | ||
insertDocToIndex(LEADER, "2", "dummy data 1",leaderIndexName) | ||
|
||
assertBusy ({ | ||
try { | ||
Assert.assertEquals(2, docCount(followerClient, followerIndexName)) | ||
} catch (ex: Exception) { | ||
Assert.fail("Exception while querying follower cluster. Failing to retry again $ex") | ||
} | ||
}, 1, TimeUnit.MINUTES) | ||
|
||
|
||
deleteConnection(FOLLOWER) | ||
followerClient.stopReplication(followerIndexName, shouldWait = true) | ||
deleteIndex(followerClient, followerIndexName) | ||
|
||
createConnectionBetweenClusters(FOLLOWER, LEADER) | ||
insertDocToIndex(LEADER, "3", "dummy data 1",leaderIndexName) | ||
insertDocToIndex(LEADER, "4", "dummy data 1",leaderIndexName) | ||
followerClient.startReplication(StartReplicationRequest("source", leaderIndexName, followerIndexName)) | ||
|
||
assertBusy ({ | ||
try { | ||
Assert.assertEquals(4, docCount(followerClient, followerIndexName)) | ||
} catch (ex: Exception) { | ||
Assert.fail("Exception while querying follower cluster. Failing to retry again") | ||
} | ||
}, 1, TimeUnit.MINUTES) | ||
} | ||
} |