"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/ShardChangesTests.java" between
elasticsearch-6.8.2-src.tar.gz and elasticsearch-6.8.3-src.tar.gz

About: elasticsearch is a Distributed, RESTful, Search Engine built on top of Apache Lucene. Source package (GitHub).

ShardChangesTests.java  (elasticsearch-6.8.2-src):ShardChangesTests.java  (elasticsearch-6.8.3-src)
skipping to change at line 19 skipping to change at line 19
import org.elasticsearch.ResourceNotFoundException; import org.elasticsearch.ResourceNotFoundException;
import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.LatchedActionListener; import org.elasticsearch.action.LatchedActionListener;
import org.elasticsearch.action.admin.indices.flush.FlushRequest; import org.elasticsearch.action.admin.indices.flush.FlushRequest;
import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeRequest; import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeRequest;
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest; import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
import org.elasticsearch.action.admin.indices.stats.ShardStats; import org.elasticsearch.action.admin.indices.stats.ShardStats;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.engine.Engine; import org.elasticsearch.index.engine.Engine;
import org.elasticsearch.index.seqno.RetentionLease;
import org.elasticsearch.index.seqno.RetentionLeaseActions;
import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.index.translog.Translog; import org.elasticsearch.index.translog.Translog;
import org.elasticsearch.plugins.Plugin; import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.ESSingleNodeTestCase; import org.elasticsearch.test.ESSingleNodeTestCase;
import org.elasticsearch.xpack.ccr.Ccr; import org.elasticsearch.xpack.ccr.Ccr;
import org.elasticsearch.xpack.ccr.LocalStateCcr; import org.elasticsearch.xpack.ccr.LocalStateCcr;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
skipping to change at line 118 skipping to change at line 121
for (int i = 0; i < 32; i++) { for (int i = 0; i < 32; i++) {
client().prepareIndex("index", "_doc", "1").setSource("{}", XContent Type.JSON).get(); client().prepareIndex("index", "_doc", "1").setSource("{}", XContent Type.JSON).get();
client().prepareDelete("index", "_doc", "1").get(); client().prepareDelete("index", "_doc", "1").get();
client().admin().indices().flush(new FlushRequest("index").force(tru e)).actionGet(); client().admin().indices().flush(new FlushRequest("index").force(tru e)).actionGet();
} }
client().admin().indices().refresh(new RefreshRequest("index")).actionGe t(); client().admin().indices().refresh(new RefreshRequest("index")).actionGe t();
ForceMergeRequest forceMergeRequest = new ForceMergeRequest("index"); ForceMergeRequest forceMergeRequest = new ForceMergeRequest("index");
forceMergeRequest.maxNumSegments(1); forceMergeRequest.maxNumSegments(1);
client().admin().indices().forceMerge(forceMergeRequest).actionGet(); client().admin().indices().forceMerge(forceMergeRequest).actionGet();
client().admin().indices().execute(RetentionLeaseActions.Add.INSTANCE, n
ew RetentionLeaseActions.AddRequest(
new ShardId(resolveIndex("index"), 0), "test", RetentionLeaseActions
.RETAIN_ALL, "ccr")).get();
ShardStats shardStats = client().admin().indices().prepareStats("index") .get().getIndex("index").getShards()[0]; ShardStats shardStats = client().admin().indices().prepareStats("index") .get().getIndex("index").getShards()[0];
String historyUUID = shardStats.getCommitStats().getUserData().get(Engin e.HISTORY_UUID_KEY); String historyUUID = shardStats.getCommitStats().getUserData().get(Engin e.HISTORY_UUID_KEY);
Collection<RetentionLease> retentionLeases = shardStats.getRetentionLeas eStats().retentionLeases().leases();
ShardChangesAction.Request request = new ShardChangesAction.Request(sha rdStats.getShardRouting().shardId(), historyUUID); ShardChangesAction.Request request = new ShardChangesAction.Request(sha rdStats.getShardRouting().shardId(), historyUUID);
request.setFromSeqNo(0L); request.setFromSeqNo(0L);
request.setMaxOperationCount(1); request.setMaxOperationCount(1);
{ {
ResourceNotFoundException e = ResourceNotFoundException e =
expectThrows(ResourceNotFoundException.class, () -> client().exe cute(ShardChangesAction.INSTANCE, request).actionGet()); expectThrows(ResourceNotFoundException.class, () -> client().exe cute(ShardChangesAction.INSTANCE, request).actionGet());
assertThat(e.getMessage(), equalTo("Operations are no longer availab assertThat(e.getMessage(), equalTo("Operations are no longer availab
le for replicating. Maybe increase the retention setting " + le for replicating. " +
"[index.soft_deletes.retention.operations]?")); "Existing retention leases [" + retentionLeases + "]; maybe incr
ease the retention lease period setting " +
"[index.soft_deletes.retention_lease.period]?"));
assertThat(e.getMetadataKeys().size(), equalTo(1)); assertThat(e.getMetadataKeys().size(), equalTo(1));
assertThat(e.getMetadata(Ccr.REQUESTED_OPS_MISSING_METADATA_KEY), no tNullValue()); assertThat(e.getMetadata(Ccr.REQUESTED_OPS_MISSING_METADATA_KEY), no tNullValue());
assertThat(e.getMetadata(Ccr.REQUESTED_OPS_MISSING_METADATA_KEY), co ntains("0", "0")); assertThat(e.getMetadata(Ccr.REQUESTED_OPS_MISSING_METADATA_KEY), co ntains("0", "0"));
} }
{ {
AtomicReference<Exception> holder = new AtomicReference<>(); AtomicReference<Exception> holder = new AtomicReference<>();
CountDownLatch latch = new CountDownLatch(1); CountDownLatch latch = new CountDownLatch(1);
client().execute(ShardChangesAction.INSTANCE, request, client().execute(ShardChangesAction.INSTANCE, request,
new LatchedActionListener<>(ActionListener.wrap(r -> fail("expec ted an exception"), holder::set), latch)); new LatchedActionListener<>(ActionListener.wrap(r -> fail("expec ted an exception"), holder::set), latch));
latch.await(); latch.await();
ElasticsearchException e = (ElasticsearchException) holder.get(); ElasticsearchException e = (ElasticsearchException) holder.get();
assertThat(e, notNullValue()); assertThat(e, notNullValue());
assertThat(e.getMetadataKeys().size(), equalTo(0)); assertThat(e.getMetadataKeys().size(), equalTo(0));
ResourceNotFoundException cause = (ResourceNotFoundException) e.getC ause(); ResourceNotFoundException cause = (ResourceNotFoundException) e.getC ause();
assertThat(cause.getMessage(), equalTo("Operations are no longer ava ilable for replicating. " + assertThat(cause.getMessage(), equalTo("Operations are no longer ava ilable for replicating. " +
"Maybe increase the retention setting [index.soft_deletes.retent "Existing retention leases [" + retentionLeases + "]; maybe incr
ion.operations]?")); ease the retention lease period setting " +
"[index.soft_deletes.retention_lease.period]?"));
assertThat(cause.getMetadataKeys().size(), equalTo(1)); assertThat(cause.getMetadataKeys().size(), equalTo(1));
assertThat(cause.getMetadata(Ccr.REQUESTED_OPS_MISSING_METADATA_KEY) , notNullValue()); assertThat(cause.getMetadata(Ccr.REQUESTED_OPS_MISSING_METADATA_KEY) , notNullValue());
assertThat(cause.getMetadata(Ccr.REQUESTED_OPS_MISSING_METADATA_KEY) , contains("0", "0")); assertThat(cause.getMetadata(Ccr.REQUESTED_OPS_MISSING_METADATA_KEY) , contains("0", "0"));
} }
} }
} }
 End of changes. 5 change blocks. 
5 lines changed or deleted 17 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)