Skip to content
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

[Backport] Add Shard Level Indexing Pressure (#478) to 1.x #1343

Merged
merged 1 commit into from
Oct 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -1283,7 +1283,15 @@ private void verifyShardInfo(XContentParser parser, boolean primary, boolean inc
assertTrue(parser.currentName().equals("id")
|| parser.currentName().equals("name")
|| parser.currentName().equals("transport_address")
|| parser.currentName().equals("weight_ranking"));
|| parser.currentName().equals("weight_ranking")
|| parser.currentName().equals("attributes"));
// Skip past attributes object
if (parser.currentName().equals("attributes")) {
while(!parser.nextToken().equals(Token.END_OBJECT)) {
parser.nextToken();
}
break;
}
} else {
assertTrue(token.isValue());
assertNotNull(parser.text());
Expand Down Expand Up @@ -1403,6 +1411,11 @@ private String verifyNodeDecisionPrologue(XContentParser parser) throws IOExcept
parser.nextToken();
assertNotNull(parser.text());
parser.nextToken();
assertEquals("node_attributes", parser.currentName());
// skip past node_attributes object
while (!parser.currentName().equals("node_decision")) {
parser.nextToken();
}
assertEquals("node_decision", parser.currentName());
parser.nextToken();
return nodeName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,15 @@ public class IndexingPressureIT extends OpenSearchIntegTestCase {

private static final Settings unboundedWriteQueue = Settings.builder().put("thread_pool.write.queue_size", -1).build();

public static final Settings settings = Settings.builder()
.put(ShardIndexingPressureSettings.SHARD_INDEXING_PRESSURE_ENABLED.getKey(), false).build();

@Override
protected Settings nodeSettings(int nodeOrdinal) {
return Settings.builder()
.put(super.nodeSettings(nodeOrdinal))
.put(unboundedWriteQueue)
.put(settings)
.build();
}

Expand Down Expand Up @@ -148,9 +152,12 @@ public void testWriteBytesAreIncremented() throws Exception {
final ActionFuture<BulkResponse> successFuture = client(coordinatingOnlyNode).bulk(bulkRequest);
replicationSendPointReached.await();

IndexingPressure primaryWriteLimits = internalCluster().getInstance(IndexingPressure.class, primaryName);
IndexingPressure replicaWriteLimits = internalCluster().getInstance(IndexingPressure.class, replicaName);
IndexingPressure coordinatingWriteLimits = internalCluster().getInstance(IndexingPressure.class, coordinatingOnlyNode);
IndexingPressure primaryWriteLimits = internalCluster()
.getInstance(IndexingPressureService.class, primaryName).getShardIndexingPressure();
IndexingPressure replicaWriteLimits = internalCluster()
.getInstance(IndexingPressureService.class, replicaName).getShardIndexingPressure();;
IndexingPressure coordinatingWriteLimits = internalCluster()
.getInstance(IndexingPressureService.class, coordinatingOnlyNode).getShardIndexingPressure();;

assertThat(primaryWriteLimits.getCurrentCombinedCoordinatingAndPrimaryBytes(), greaterThan(bulkShardRequestSize));
assertThat(primaryWriteLimits.getCurrentPrimaryBytes(), greaterThan(bulkShardRequestSize));
Expand Down Expand Up @@ -271,9 +278,12 @@ public void testWriteCanBeRejectedAtCoordinatingLevel() throws Exception {
try (Releasable replicaRelease = blockReplicas(replicaThreadPool)) {
final ActionFuture<BulkResponse> successFuture = client(coordinatingOnlyNode).bulk(bulkRequest);

IndexingPressure primaryWriteLimits = internalCluster().getInstance(IndexingPressure.class, primaryName);
IndexingPressure replicaWriteLimits = internalCluster().getInstance(IndexingPressure.class, replicaName);
IndexingPressure coordinatingWriteLimits = internalCluster().getInstance(IndexingPressure.class, coordinatingOnlyNode);
IndexingPressure primaryWriteLimits = internalCluster()
.getInstance(IndexingPressureService.class, primaryName).getShardIndexingPressure();
IndexingPressure replicaWriteLimits = internalCluster()
.getInstance(IndexingPressureService.class, replicaName).getShardIndexingPressure();
IndexingPressure coordinatingWriteLimits = internalCluster()
.getInstance(IndexingPressureService.class, coordinatingOnlyNode).getShardIndexingPressure();

assertBusy(() -> {
assertThat(primaryWriteLimits.getCurrentCombinedCoordinatingAndPrimaryBytes(), greaterThan(bulkShardRequestSize));
Expand Down Expand Up @@ -335,9 +345,12 @@ public void testWriteCanBeRejectedAtPrimaryLevel() throws Exception {
try (Releasable replicaRelease = blockReplicas(replicaThreadPool)) {
final ActionFuture<BulkResponse> successFuture = client(primaryName).bulk(bulkRequest);

IndexingPressure primaryWriteLimits = internalCluster().getInstance(IndexingPressure.class, primaryName);
IndexingPressure replicaWriteLimits = internalCluster().getInstance(IndexingPressure.class, replicaName);
IndexingPressure coordinatingWriteLimits = internalCluster().getInstance(IndexingPressure.class, coordinatingOnlyNode);
IndexingPressure primaryWriteLimits = internalCluster()
.getInstance(IndexingPressureService.class, primaryName).getShardIndexingPressure();
IndexingPressure replicaWriteLimits = internalCluster()
.getInstance(IndexingPressureService.class, replicaName).getShardIndexingPressure();
IndexingPressure coordinatingWriteLimits = internalCluster()
.getInstance(IndexingPressureService.class, coordinatingOnlyNode).getShardIndexingPressure();

assertBusy(() -> {
assertThat(primaryWriteLimits.getCurrentCombinedCoordinatingAndPrimaryBytes(), greaterThan(bulkShardRequestSize));
Expand Down
Loading