8
8
9
9
package org .opensearch .remotestore ;
10
10
11
+ import com .carrotsearch .randomizedtesting .annotations .ParametersFactory ;
12
+ import com .carrotsearch .randomizedtesting .annotations .ThreadLeakFilters ;
13
+
11
14
import org .opensearch .action .DocWriteResponse ;
12
15
import org .opensearch .action .LatchedActionListener ;
13
16
import org .opensearch .action .admin .cluster .remotestore .restore .RestoreRemoteStoreRequest ;
30
33
import org .opensearch .common .util .io .IOUtils ;
31
34
import org .opensearch .core .action .ActionListener ;
32
35
import org .opensearch .core .common .unit .ByteSizeUnit ;
36
+ import org .opensearch .core .common .unit .ByteSizeValue ;
33
37
import org .opensearch .core .index .Index ;
34
38
import org .opensearch .core .rest .RestStatus ;
35
39
import org .opensearch .index .IndexService ;
36
40
import org .opensearch .index .IndexSettings ;
37
41
import org .opensearch .index .remote .RemoteStoreEnums .PathHashAlgorithm ;
38
42
import org .opensearch .index .remote .RemoteStoreEnums .PathType ;
39
43
import org .opensearch .index .shard .IndexShard ;
44
+ import org .opensearch .index .store .remote .file .CleanerDaemonThreadLeakFilter ;
40
45
import org .opensearch .indices .IndicesService ;
41
46
import org .opensearch .indices .RemoteStoreSettings ;
42
47
import org .opensearch .indices .recovery .RecoveryState ;
43
48
import org .opensearch .indices .replication .common .ReplicationType ;
49
+ import org .opensearch .node .Node ;
44
50
import org .opensearch .node .remotestore .RemoteStorePinnedTimestampService ;
45
51
import org .opensearch .repositories .RepositoriesService ;
46
52
import org .opensearch .repositories .Repository ;
60
66
import java .nio .file .Path ;
61
67
import java .util .ArrayList ;
62
68
import java .util .Arrays ;
69
+ import java .util .Collection ;
63
70
import java .util .Collections ;
64
71
import java .util .List ;
65
72
import java .util .Map ;
77
84
import static org .opensearch .cluster .metadata .IndexMetadata .SETTING_REMOTE_SEGMENT_STORE_REPOSITORY ;
78
85
import static org .opensearch .cluster .metadata .IndexMetadata .SETTING_REMOTE_STORE_ENABLED ;
79
86
import static org .opensearch .cluster .metadata .IndexMetadata .SETTING_REMOTE_TRANSLOG_STORE_REPOSITORY ;
87
+ import static org .opensearch .common .util .FeatureFlags .WRITABLE_WARM_INDEX_SETTING ;
80
88
import static org .opensearch .index .remote .RemoteStoreEnums .DataCategory .SEGMENTS ;
81
89
import static org .opensearch .index .remote .RemoteStoreEnums .DataCategory .TRANSLOG ;
82
90
import static org .opensearch .index .remote .RemoteStoreEnums .DataType .DATA ;
89
97
import static org .hamcrest .Matchers .greaterThanOrEqualTo ;
90
98
import static org .hamcrest .Matchers .lessThanOrEqualTo ;
91
99
100
+ @ ThreadLeakFilters (filters = CleanerDaemonThreadLeakFilter .class )
92
101
@ OpenSearchIntegTestCase .ClusterScope (scope = OpenSearchIntegTestCase .Scope .TEST , numDataNodes = 0 )
93
102
public class RemoteRestoreSnapshotIT extends RemoteSnapshotIT {
94
103
104
+ public RemoteRestoreSnapshotIT (Settings nodeSettings ) {
105
+ super (nodeSettings );
106
+ }
107
+
108
+ @ ParametersFactory
109
+ public static Collection <Object []> parameters () {
110
+ return Arrays .asList (
111
+ new Object [] { Settings .builder ().put (WRITABLE_WARM_INDEX_SETTING .getKey (), false ).build () },
112
+ new Object [] { Settings .builder ().put (WRITABLE_WARM_INDEX_SETTING .getKey (), true ).build () }
113
+ );
114
+ }
115
+
116
+ @ Override
117
+ protected Settings nodeSettings (int nodeOrdinal ) {
118
+ ByteSizeValue cacheSize = new ByteSizeValue (16 , ByteSizeUnit .GB );
119
+ return Settings .builder ()
120
+ .put (super .nodeSettings (nodeOrdinal ))
121
+ .put (Node .NODE_SEARCH_CACHE_SIZE_SETTING .getKey (), cacheSize .toString ())
122
+ .build ();
123
+ }
124
+
95
125
private void assertDocsPresentInIndex (Client client , String indexName , int numOfDocs ) {
96
126
for (int i = 0 ; i < numOfDocs ; i ++) {
97
127
String id = Integer .toString (i );
@@ -102,7 +132,7 @@ private void assertDocsPresentInIndex(Client client, String indexName, int numOf
102
132
103
133
public void testRestoreOperationsShallowCopyEnabled () throws Exception {
104
134
String clusterManagerNode = internalCluster ().startClusterManagerOnlyNode ();
105
- String primary = internalCluster ().startDataOnlyNode ( );
135
+ String primary = internalCluster ().startDataAndWarmNodes ( 1 ). get ( 0 );
106
136
String indexName1 = "testindex1" ;
107
137
String indexName2 = "testindex2" ;
108
138
String snapshotRepoName = "test-restore-snapshot-repo" ;
@@ -128,7 +158,7 @@ public void testRestoreOperationsShallowCopyEnabled() throws Exception {
128
158
indexDocuments (client , indexName2 , numDocsInIndex2 );
129
159
ensureGreen (indexName1 , indexName2 );
130
160
131
- internalCluster ().startDataOnlyNode ( );
161
+ internalCluster ().startDataAndWarmNodes ( 1 );
132
162
logger .info ("--> snapshot" );
133
163
134
164
SnapshotInfo snapshotInfo = createSnapshot (snapshotRepoName , snapshotName1 , new ArrayList <>(Arrays .asList (indexName1 , indexName2 )));
@@ -200,7 +230,7 @@ public void testRestoreOperationsShallowCopyEnabled() throws Exception {
200
230
*/
201
231
public void testRemoteStoreCustomDataOnIndexCreationAndRestore () {
202
232
String clusterManagerNode = internalCluster ().startClusterManagerOnlyNode ();
203
- internalCluster ().startDataOnlyNode ( );
233
+ internalCluster ().startDataAndWarmNodes ( 1 );
204
234
String indexName1 = "testindex1" ;
205
235
String indexName2 = "testindex2" ;
206
236
String snapshotRepoName = "test-restore-snapshot-repo" ;
@@ -313,7 +343,7 @@ private void validatePathType(String index, PathType pathType, @Nullable PathHas
313
343
314
344
public void testRestoreInSameRemoteStoreEnabledIndex () throws IOException {
315
345
String clusterManagerNode = internalCluster ().startClusterManagerOnlyNode ();
316
- String primary = internalCluster ().startDataOnlyNode ( );
346
+ String primary = internalCluster ().startDataAndWarmNodes ( 1 ). get ( 0 );
317
347
String indexName1 = "testindex1" ;
318
348
String indexName2 = "testindex2" ;
319
349
String snapshotRepoName = "test-restore-snapshot-repo" ;
@@ -339,7 +369,7 @@ public void testRestoreInSameRemoteStoreEnabledIndex() throws IOException {
339
369
indexDocuments (client , indexName2 , numDocsInIndex2 );
340
370
ensureGreen (indexName1 , indexName2 );
341
371
342
- internalCluster ().startDataOnlyNode ( );
372
+ internalCluster ().startDataAndWarmNodes ( 1 );
343
373
logger .info ("--> snapshot" );
344
374
SnapshotInfo snapshotInfo1 = createSnapshot (
345
375
snapshotRepoName ,
@@ -441,7 +471,7 @@ void assertRemoteSegmentsAndTranslogUploaded(String idx) throws IOException {
441
471
442
472
public void testRemoteRestoreIndexRestoredFromSnapshot () throws IOException , ExecutionException , InterruptedException {
443
473
internalCluster ().startClusterManagerOnlyNode ();
444
- internalCluster ().startDataOnlyNodes (2 );
474
+ internalCluster ().startDataAndWarmNodes (2 );
445
475
446
476
String indexName1 = "testindex1" ;
447
477
String snapshotRepoName = "test-restore-snapshot-repo" ;
@@ -500,7 +530,7 @@ public void testRemoteRestoreIndexRestoredFromSnapshot() throws IOException, Exe
500
530
501
531
public void testSuccessfulIndexRestoredFromSnapshotWithUpdatedSetting () throws IOException , ExecutionException , InterruptedException {
502
532
internalCluster ().startClusterManagerOnlyNode ();
503
- internalCluster ().startDataOnlyNodes (2 );
533
+ internalCluster ().startDataAndWarmNodes (2 );
504
534
505
535
String indexName1 = "testindex1" ;
506
536
String snapshotRepoName = "test-restore-snapshot-repo" ;
@@ -716,7 +746,7 @@ public void testRestoreShallowSnapshotIndexAfterSnapshot() throws ExecutionExcep
716
746
717
747
public void testInvalidRestoreRequestScenarios () throws Exception {
718
748
internalCluster ().startClusterManagerOnlyNode ();
719
- internalCluster ().startDataOnlyNode ( );
749
+ internalCluster ().startDataAndWarmNodes ( 1 );
720
750
String index = "test-index" ;
721
751
String snapshotRepo = "test-restore-snapshot-repo" ;
722
752
String newRemoteStoreRepo = "test-new-rs-repo" ;
@@ -736,7 +766,7 @@ public void testInvalidRestoreRequestScenarios() throws Exception {
736
766
indexDocuments (client , index , numDocsInIndex );
737
767
ensureGreen (index );
738
768
739
- internalCluster ().startDataOnlyNode ( );
769
+ internalCluster ().startDataAndWarmNodes ( 1 );
740
770
logger .info ("--> snapshot" );
741
771
742
772
SnapshotInfo snapshotInfo = createSnapshot (snapshotRepo , snapshotName1 , new ArrayList <>(List .of (index )));
@@ -896,8 +926,8 @@ public void testInvalidRestoreRequestScenarios() throws Exception {
896
926
897
927
public void testCreateSnapshotV2_Orphan_Timestamp_Cleanup () throws Exception {
898
928
internalCluster ().startClusterManagerOnlyNode (pinnedTimestampSettings ());
899
- internalCluster ().startDataOnlyNode ( pinnedTimestampSettings ());
900
- internalCluster ().startDataOnlyNode ( pinnedTimestampSettings ());
929
+ internalCluster ().startDataAndWarmNodes ( 1 , pinnedTimestampSettings ());
930
+ internalCluster ().startDataAndWarmNodes ( 1 , pinnedTimestampSettings ());
901
931
String indexName1 = "testindex1" ;
902
932
String indexName2 = "testindex2" ;
903
933
String snapshotRepoName = "test-create-snapshot-repo" ;
@@ -962,8 +992,8 @@ public void onFailure(Exception e) {}
962
992
public void testMixedSnapshotCreationWithV2RepositorySetting () throws Exception {
963
993
964
994
internalCluster ().startClusterManagerOnlyNode (pinnedTimestampSettings ());
965
- internalCluster ().startDataOnlyNode ( pinnedTimestampSettings ());
966
- internalCluster ().startDataOnlyNode ( pinnedTimestampSettings ());
995
+ internalCluster ().startDataAndWarmNodes ( 1 , pinnedTimestampSettings ());
996
+ internalCluster ().startDataAndWarmNodes ( 1 , pinnedTimestampSettings ());
967
997
String indexName1 = "testindex1" ;
968
998
String indexName2 = "testindex2" ;
969
999
String indexName3 = "testindex3" ;
@@ -1034,8 +1064,8 @@ public void testMixedSnapshotCreationWithV2RepositorySetting() throws Exception
1034
1064
1035
1065
public void testConcurrentSnapshotV2CreateOperation () throws InterruptedException , ExecutionException {
1036
1066
internalCluster ().startClusterManagerOnlyNode (pinnedTimestampSettings ());
1037
- internalCluster ().startDataOnlyNode ( pinnedTimestampSettings ());
1038
- internalCluster ().startDataOnlyNode ( pinnedTimestampSettings ());
1067
+ internalCluster ().startDataAndWarmNodes ( 1 , pinnedTimestampSettings ());
1068
+ internalCluster ().startDataAndWarmNodes ( 1 , pinnedTimestampSettings ());
1039
1069
String indexName1 = "testindex1" ;
1040
1070
String indexName2 = "testindex2" ;
1041
1071
String snapshotRepoName = "test-create-snapshot-repo" ;
@@ -1108,8 +1138,8 @@ public void testConcurrentSnapshotV2CreateOperation_MasterChange() throws Except
1108
1138
internalCluster ().startClusterManagerOnlyNode (pinnedTimestampSettings ());
1109
1139
internalCluster ().startClusterManagerOnlyNode (pinnedTimestampSettings ());
1110
1140
internalCluster ().startClusterManagerOnlyNode (pinnedTimestampSettings ());
1111
- internalCluster ().startDataOnlyNode ( pinnedTimestampSettings ());
1112
- internalCluster ().startDataOnlyNode ( pinnedTimestampSettings ());
1141
+ internalCluster ().startDataAndWarmNodes ( 1 , pinnedTimestampSettings ());
1142
+ internalCluster ().startDataAndWarmNodes ( 1 , pinnedTimestampSettings ());
1113
1143
String indexName1 = "testindex1" ;
1114
1144
String indexName2 = "testindex2" ;
1115
1145
String snapshotRepoName = "test-create-snapshot-repo" ;
@@ -1184,8 +1214,8 @@ public void testConcurrentSnapshotV2CreateOperation_MasterChange() throws Except
1184
1214
1185
1215
public void testCreateSnapshotV2 () throws Exception {
1186
1216
internalCluster ().startClusterManagerOnlyNode (pinnedTimestampSettings ());
1187
- internalCluster ().startDataOnlyNode ( pinnedTimestampSettings ());
1188
- internalCluster ().startDataOnlyNode ( pinnedTimestampSettings ());
1217
+ internalCluster ().startDataAndWarmNodes ( 1 , pinnedTimestampSettings ());
1218
+ internalCluster ().startDataAndWarmNodes ( 1 , pinnedTimestampSettings ());
1189
1219
String indexName1 = "testindex1" ;
1190
1220
String indexName2 = "testindex2" ;
1191
1221
String indexName3 = "testindex3" ;
@@ -1254,8 +1284,8 @@ public void forceSyncPinnedTimestamps() {
1254
1284
1255
1285
public void testCreateSnapshotV2WithRedIndex () throws Exception {
1256
1286
internalCluster ().startClusterManagerOnlyNode (pinnedTimestampSettings ());
1257
- internalCluster ().startDataOnlyNode ( pinnedTimestampSettings ());
1258
- internalCluster ().startDataOnlyNode ( pinnedTimestampSettings ());
1287
+ internalCluster ().startDataAndWarmNodes ( 1 , pinnedTimestampSettings ());
1288
+ internalCluster ().startDataAndWarmNodes ( 1 , pinnedTimestampSettings ());
1259
1289
String indexName1 = "testindex1" ;
1260
1290
String indexName2 = "testindex2" ;
1261
1291
String snapshotRepoName = "test-create-snapshot-repo" ;
@@ -1302,8 +1332,8 @@ public void testCreateSnapshotV2WithRedIndex() throws Exception {
1302
1332
1303
1333
public void testCreateSnapshotV2WithIndexingLoad () throws Exception {
1304
1334
internalCluster ().startClusterManagerOnlyNode (pinnedTimestampSettings ());
1305
- internalCluster ().startDataOnlyNode ( pinnedTimestampSettings ());
1306
- internalCluster ().startDataOnlyNode ( pinnedTimestampSettings ());
1335
+ internalCluster ().startDataAndWarmNodes ( 1 , pinnedTimestampSettings ());
1336
+ internalCluster ().startDataAndWarmNodes ( 1 , pinnedTimestampSettings ());
1307
1337
String indexName1 = "testindex1" ;
1308
1338
String indexName2 = "testindex2" ;
1309
1339
String snapshotRepoName = "test-create-snapshot-repo" ;
@@ -1370,8 +1400,8 @@ public void testCreateSnapshotV2WithIndexingLoad() throws Exception {
1370
1400
1371
1401
public void testCreateSnapshotV2WithShallowCopySettingDisabled () throws Exception {
1372
1402
internalCluster ().startClusterManagerOnlyNode (pinnedTimestampSettings ());
1373
- internalCluster ().startDataOnlyNode ( pinnedTimestampSettings ());
1374
- internalCluster ().startDataOnlyNode ( pinnedTimestampSettings ());
1403
+ internalCluster ().startDataAndWarmNodes ( 1 , pinnedTimestampSettings ());
1404
+ internalCluster ().startDataAndWarmNodes ( 1 , pinnedTimestampSettings ());
1375
1405
String indexName1 = "testindex1" ;
1376
1406
String indexName2 = "testindex2" ;
1377
1407
String snapshotRepoName = "test-create-snapshot-repo" ;
@@ -1419,7 +1449,7 @@ public void testCreateSnapshotV2WithShallowCopySettingDisabled() throws Exceptio
1419
1449
public void testClusterManagerFailoverDuringSnapshotCreation () throws Exception {
1420
1450
1421
1451
internalCluster ().startClusterManagerOnlyNodes (3 , pinnedTimestampSettings ());
1422
- internalCluster ().startDataOnlyNode ( pinnedTimestampSettings ());
1452
+ internalCluster ().startDataAndWarmNodes ( 1 , pinnedTimestampSettings ());
1423
1453
String indexName1 = "testindex1" ;
1424
1454
String indexName2 = "testindex2" ;
1425
1455
String snapshotRepoName = "test-create-snapshot-repo" ;
@@ -1493,8 +1523,8 @@ public void testClusterManagerFailoverDuringSnapshotCreation() throws Exception
1493
1523
1494
1524
public void testConcurrentV1SnapshotAndV2RepoSettingUpdate () throws Exception {
1495
1525
internalCluster ().startClusterManagerOnlyNode (pinnedTimestampSettings ());
1496
- internalCluster ().startDataOnlyNode ( pinnedTimestampSettings ());
1497
- internalCluster ().startDataOnlyNode ( pinnedTimestampSettings ());
1526
+ internalCluster ().startDataAndWarmNodes ( 1 , pinnedTimestampSettings ());
1527
+ internalCluster ().startDataAndWarmNodes ( 1 , pinnedTimestampSettings ());
1498
1528
String snapshotRepoName = "test-create-snapshot-repo" ;
1499
1529
String snapshotName1 = "test-create-snapshot-v1" ;
1500
1530
Path absolutePath1 = randomRepoPath ().toAbsolutePath ();
0 commit comments