Class AbstractSnapshotIntegTestCase

java.lang.Object
org.junit.Assert
org.apache.lucene.tests.util.LuceneTestCase

public abstract class AbstractSnapshotIntegTestCase extends ParameterizedStaticSettingsOpenSearchIntegTestCase
  • Field Details

    • TEST_REMOTE_STORE_REPO_SUFFIX

      protected static final String TEST_REMOTE_STORE_REPO_SUFFIX
      See Also:
    • LARGE_SNAPSHOT_POOL_SETTINGS

      protected static final org.opensearch.common.settings.Settings LARGE_SNAPSHOT_POOL_SETTINGS
    • settings

      protected final org.opensearch.common.settings.Settings settings
  • Constructor Details

    • AbstractSnapshotIntegTestCase

      public AbstractSnapshotIntegTestCase(org.opensearch.common.settings.Settings nodeSettings)
    • AbstractSnapshotIntegTestCase

      public AbstractSnapshotIntegTestCase()
  • Method Details

    • addMockIndexStorePlugin

      protected boolean addMockIndexStorePlugin()
      Overrides:
      addMockIndexStorePlugin in class OpenSearchIntegTestCase
    • nodeSettings

      protected org.opensearch.common.settings.Settings nodeSettings(int nodeOrdinal)
      Description copied from class: OpenSearchIntegTestCase
      This method is used to obtain settings for the Nth node in the cluster. Nodes in this cluster are associated with an ordinal number such that nodes can be started with specific configurations. This method might be called multiple times with the same ordinal and is expected to return the same value for each invocation. In other words subclasses must ensure this method is idempotent.
      Overrides:
      nodeSettings in class ParameterizedStaticSettingsOpenSearchIntegTestCase
    • nodePlugins

      protected Collection<Class<? extends org.opensearch.plugins.Plugin>> nodePlugins()
      Description copied from class: OpenSearchIntegTestCase
      Returns a collection of plugins that should be loaded on each node.
      Overrides:
      nodePlugins in class OpenSearchIntegTestCase
    • assertConsistentHistoryInLuceneIndex

      public void assertConsistentHistoryInLuceneIndex() throws Exception
      Throws:
      Exception
    • verifyNoLeakedListeners

      public void verifyNoLeakedListeners() throws Exception
      Throws:
      Exception
    • assertRepoConsistency

      public void assertRepoConsistency()
    • disableRepoConsistencyCheck

      protected void disableRepoConsistencyCheck(String reason)
    • getRepositoryData

      protected org.opensearch.repositories.RepositoryData getRepositoryData(String repository)
    • getRepositoryData

      protected org.opensearch.repositories.RepositoryData getRepositoryData(org.opensearch.repositories.Repository repository)
    • getFailureCount

      public static long getFailureCount(String repository)
    • assertFileCount

      public static void assertFileCount(Path dir, int expectedCount) throws IOException
      Throws:
      IOException
    • numberOfFiles

      public static int numberOfFiles(Path dir) throws IOException
      Throws:
      IOException
    • stopNode

      public static void stopNode(String node) throws IOException
      Throws:
      IOException
    • waitForBlock

      public void waitForBlock(String node, String repository, org.opensearch.common.unit.TimeValue timeout) throws InterruptedException
      Throws:
      InterruptedException
    • waitForCompletion

      public org.opensearch.snapshots.SnapshotInfo waitForCompletion(String repository, String snapshotName, org.opensearch.common.unit.TimeValue timeout) throws InterruptedException
      Throws:
      InterruptedException
    • blockClusterManagerFromFinalizingSnapshotOnIndexFile

      public static String blockClusterManagerFromFinalizingSnapshotOnIndexFile(String repositoryName)
    • blockClusterManagerOnWriteIndexFile

      public static String blockClusterManagerOnWriteIndexFile(String repositoryName)
    • blockClusterManagerFromDeletingIndexNFile

      public static void blockClusterManagerFromDeletingIndexNFile(String repositoryName)
    • blockClusterManagerFromFinalizingSnapshotOnSnapFile

      public static String blockClusterManagerFromFinalizingSnapshotOnSnapFile(String repositoryName)
    • blockNodeWithIndex

      public static String blockNodeWithIndex(String repositoryName, String indexName)
    • blockNodeOnAnyFiles

      public static void blockNodeOnAnyFiles(String repository, String nodeName)
    • blockNodeOnAnySegmentFile

      public static void blockNodeOnAnySegmentFile(String repository, String nodeName)
    • blockDataNode

      public static void blockDataNode(String repository, String nodeName)
    • blockAllDataNodes

      public static void blockAllDataNodes(String repository)
    • unblockAllDataNodes

      public static void unblockAllDataNodes(String repository)
    • failReadsAllDataNodes

      public static void failReadsAllDataNodes(String repository)
    • waitForBlockOnAnyDataNode

      public static void waitForBlockOnAnyDataNode(String repository, org.opensearch.common.unit.TimeValue timeout) throws InterruptedException
      Throws:
      InterruptedException
    • unblockNode

      public void unblockNode(String repository, String node)
    • createRepository

      protected void createRepository(String repoName, String type, Path location)
    • getRepositorySettings

      protected org.opensearch.common.settings.Settings.Builder getRepositorySettings(Path location, boolean shallowCopyEnabled)
    • getRepositorySettings

      protected org.opensearch.common.settings.Settings.Builder getRepositorySettings(Path location, String basePath, boolean shallowCopyEnabled)
    • createRepository

      protected void createRepository(String repoName, String type)
    • randomRepositorySettings

      protected org.opensearch.common.settings.Settings.Builder randomRepositorySettings()
    • snapshotRepoSettingsForShallowCopy

      protected org.opensearch.common.settings.Settings.Builder snapshotRepoSettingsForShallowCopy()
    • indexSettingsNoReplicas

      protected static org.opensearch.common.settings.Settings.Builder indexSettingsNoReplicas(int shards)
    • maybeInitWithOldSnapshotVersion

      protected void maybeInitWithOldSnapshotVersion(String repoName, Path repoPath) throws IOException
      Randomly write an empty snapshot of an older version to an empty repository to simulate an older repository metadata format.
      Throws:
      IOException
    • initWithSnapshotVersion

      protected String initWithSnapshotVersion(String repoName, Path repoPath, org.opensearch.Version version) throws IOException
      Workaround to simulate BwC situation: taking a snapshot without indices here so that we don't create any new version shard generations (the existence of which would short-circuit checks for the repo containing old version snapshots)
      Throws:
      IOException
    • createFullSnapshot

      protected org.opensearch.snapshots.SnapshotInfo createFullSnapshot(String repoName, String snapshotName)
    • createSnapshot

      protected org.opensearch.snapshots.SnapshotInfo createSnapshot(String repositoryName, String snapshot, List<String> indices)
    • restoreSnapshot

      protected void restoreSnapshot(String repositoryName, String snapshotName, String indexName, String restoredIndexName, org.opensearch.common.settings.Settings indexSettings)
    • createIndexWithRandomDocs

      protected void createIndexWithRandomDocs(String indexName, int docCount) throws InterruptedException
      Throws:
      InterruptedException
    • indexRandomDocs

      protected void indexRandomDocs(String index, int numdocs) throws InterruptedException
      Throws:
      InterruptedException
    • getRemoteStoreBackedIndexSettings

      protected org.opensearch.common.settings.Settings getRemoteStoreBackedIndexSettings()
    • snapshotRepoSettingsForShallowCopy

      protected org.opensearch.common.settings.Settings.Builder snapshotRepoSettingsForShallowCopy(Path path)
    • getCountForIndex

      protected long getCountForIndex(String indexName)
    • assertDocCount

      protected void assertDocCount(String index, long count)
    • getLockFilesInRemoteStore

      protected String[] getLockFilesInRemoteStore(String remoteStoreIndex, String remoteStoreRepositoryName) throws IOException
      Throws:
      IOException
    • addBwCFailedSnapshot

      protected void addBwCFailedSnapshot(String repoName, String snapshotName, Map<String,Object> metadata) throws Exception
      Adds a snapshot in state SnapshotState.FAILED to the given repository.
      Parameters:
      repoName - repository to add snapshot to
      snapshotName - name for the new failed snapshot
      metadata - snapshot metadata to write (as returned by SnapshotInfo.userMetadata())
      Throws:
      Exception
    • awaitNoMoreRunningOperations

      protected void awaitNoMoreRunningOperations() throws Exception
      Throws:
      Exception
    • awaitNoMoreRunningOperations

      protected void awaitNoMoreRunningOperations(String viaNode) throws Exception
      Throws:
      Exception
    • awaitClusterState

      protected void awaitClusterState(Predicate<org.opensearch.cluster.ClusterState> statePredicate) throws Exception
      Throws:
      Exception
    • awaitClusterState

      protected void awaitClusterState(String viaNode, Predicate<org.opensearch.cluster.ClusterState> statePredicate) throws Exception
      Throws:
      Exception
    • deleteSnapshotBlockedOnClusterManager

      protected org.opensearch.common.action.ActionFuture<org.opensearch.action.support.clustermanager.AcknowledgedResponse> deleteSnapshotBlockedOnClusterManager(String repoName, String snapshotName)
    • deleteSnapshot

      protected org.opensearch.common.action.ActionFuture<org.opensearch.action.support.clustermanager.AcknowledgedResponse> deleteSnapshot(String repoName, String snapshotName)
    • startFullSnapshotBlockedOnDataNode

      protected org.opensearch.common.action.ActionFuture<org.opensearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse> startFullSnapshotBlockedOnDataNode(String snapshotName, String repoName, String dataNode) throws InterruptedException
      Throws:
      InterruptedException
    • startFullSnapshot

      protected org.opensearch.common.action.ActionFuture<org.opensearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse> startFullSnapshot(String repoName, String snapshotName)
    • startFullSnapshot

      protected org.opensearch.common.action.ActionFuture<org.opensearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse> startFullSnapshot(String repoName, String snapshotName, boolean partial)
    • awaitNumberOfSnapshotsInProgress

      protected void awaitNumberOfSnapshotsInProgress(int count) throws Exception
      Throws:
      Exception
    • assertSuccessful

      protected static org.opensearch.snapshots.SnapshotInfo assertSuccessful(org.opensearch.common.action.ActionFuture<org.opensearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse> future) throws Exception
      Throws:
      Exception
    • createIndexWithContent

      protected void createIndexWithContent(String indexName)
    • createIndexWithContent

      protected void createIndexWithContent(String indexName, org.opensearch.common.settings.Settings indexSettings)
    • startDeleteSnapshot

      protected org.opensearch.common.action.ActionFuture<org.opensearch.action.support.clustermanager.AcknowledgedResponse> startDeleteSnapshot(String repoName, String snapshotName)
    • updateClusterState

      protected void updateClusterState(Function<org.opensearch.cluster.ClusterState, org.opensearch.cluster.ClusterState> updater) throws Exception
      Throws:
      Exception
    • getSnapshot

      protected org.opensearch.snapshots.SnapshotInfo getSnapshot(String repository, String snapshot)
    • awaitClusterManagerFinishRepoOperations

      protected void awaitClusterManagerFinishRepoOperations() throws Exception
      Throws:
      Exception
    • indexRandomForConcurrentSearch

      public void indexRandomForConcurrentSearch(String... indices) throws InterruptedException
      Throws:
      InterruptedException