Package org.elasticsearch.index.seqno
Class SequenceNumbersTestUtils
java.lang.Object
org.elasticsearch.index.seqno.SequenceNumbersTestUtils
Utilities for asserting on sequence number fields at the Lucene level in integration tests.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidassertMinRetainedSeqNoAdvanced(InternalTestCluster cluster, String indexName, long expectedSeqNo) Waits until the minimum retained sequence number on the primary shard of the given index has advanced to at least the expected value.static voidassertRetentionLeasesAdvanced(Client client, String indexName, long expectedRetainingSeqNo) Waits until all retention leases on all shards of the given index have their retaining sequence number equal to the expected value.static voidassertShardsHaveSeqNoDocValues(String indexName, boolean expectDocValuesOnDisk, int expectedShards) Asserts that all shards of the given index either have or lack_seq_nodoc values on disk.static voidassertShardsHaveSeqNoDocValues(InternalTestCluster cluster, String indexName, boolean expectDocValuesOnDisk, int expectedShards) Asserts that all shards of the given index on the given cluster either have or lack_seq_nodoc values on disk.static voidassertShardsSeqNoDocValuesCount(IndicesService indicesService, String indexName, long expectedCount, int expectedShards) Asserts that the total number of_seq_nodoc values for each shard of the given index on a specific node equals the expected count.static voidassertShardsSeqNoDocValuesCount(InternalTestCluster cluster, String indexName, long expectedCount, int expectedShards) Asserts that the total number of_seq_nodoc values across all shards of the given index equals the expected count.static voidPersist the global checkpoint on all primary shards of the given index into disk.static voidpersistGlobalCheckpointOnPrimaryShards(InternalTestCluster cluster, String indexName) Persist the global checkpoint on all primary shards of the given index into disk.
-
Method Details
-
assertShardsHaveSeqNoDocValues
public static void assertShardsHaveSeqNoDocValues(String indexName, boolean expectDocValuesOnDisk, int expectedShards) throws Exception Asserts that all shards of the given index either have or lack_seq_nodoc values on disk. Uses the defaultESIntegTestCase.internalCluster().- Parameters:
indexName- the index to checkexpectDocValuesOnDisk-trueto assert doc values are present,falseto assert they are emptyexpectedShards- the exact number of shards expected to be verified- Throws:
Exception
-
assertShardsHaveSeqNoDocValues
public static void assertShardsHaveSeqNoDocValues(InternalTestCluster cluster, String indexName, boolean expectDocValuesOnDisk, int expectedShards) throws Exception Asserts that all shards of the given index on the given cluster either have or lack_seq_nodoc values on disk.- Parameters:
cluster- the cluster to checkindexName- the index to checkexpectDocValuesOnDisk-trueto assert doc values are present,falseto assert they are emptyexpectedShards- the exact number of shards expected to be verified- Throws:
Exception
-
assertShardsSeqNoDocValuesCount
public static void assertShardsSeqNoDocValuesCount(InternalTestCluster cluster, String indexName, long expectedCount, int expectedShards) Asserts that the total number of_seq_nodoc values across all shards of the given index equals the expected count.- Parameters:
cluster- the cluster to checkindexName- the index to checkexpectedCount- the expected total number of doc values per shardexpectedShards- the exact number of shards expected to be verified
-
assertShardsSeqNoDocValuesCount
public static void assertShardsSeqNoDocValuesCount(IndicesService indicesService, String indexName, long expectedCount, int expectedShards) Asserts that the total number of_seq_nodoc values for each shard of the given index on a specific node equals the expected count.- Parameters:
indicesService- theIndicesServiceinstance for the node to checkindexName- the index to checkexpectedCount- the expected total number of doc values per shardexpectedShards- the exact number of shards expected to be verified
-
assertMinRetainedSeqNoAdvanced
public static void assertMinRetainedSeqNoAdvanced(InternalTestCluster cluster, String indexName, long expectedSeqNo) throws Exception Waits until the minimum retained sequence number on the primary shard of the given index has advanced to at least the expected value. Calling `getMinRetainedSeqNo()` directly on the shard advances the cached value whenever the retention lock is not held. This method retries via `assertBusy` to find such a window, ensuring the value is stored durably.- Parameters:
cluster- the cluster containing the indexindexName- the index to checkexpectedSeqNo- the expected minimum retained sequence number- Throws:
Exception
-
assertRetentionLeasesAdvanced
public static void assertRetentionLeasesAdvanced(Client client, String indexName, long expectedRetainingSeqNo) throws Exception Waits until all retention leases on all shards of the given index have their retaining sequence number equal to the expected value.- Parameters:
client- the client to use for stats requestsindexName- the index to checkexpectedRetainingSeqNo- the expected retaining sequence number for every lease- Throws:
Exception
-
persistGlobalCheckpointOnPrimaryShards
Persist the global checkpoint on all primary shards of the given index into disk. This makes sure that the persisted global checkpoint on those shards will equal to the in-memory value. This helper method is useful if you do not use replicas in your test setup. Uses the defaultESIntegTestCase.internalCluster().- Throws:
Exception
-
persistGlobalCheckpointOnPrimaryShards
public static void persistGlobalCheckpointOnPrimaryShards(InternalTestCluster cluster, String indexName) throws Exception Persist the global checkpoint on all primary shards of the given index into disk. This makes sure that the persisted global checkpoint on those shards will equal to the in-memory value. This helper method is useful if you do not use replicas in your test setup.- Parameters:
cluster- the cluster containing the indexindexName- the name of the index- Throws:
Exception
-