@@ -24,6 +24,10 @@ class TestDiskBalance(Tester):
24
24
@jira_ticket CASSANDRA-6696
25
25
"""
26
26
27
+ STCS_COMPACTION_OPTS = "SizeTieredCompactionStrategy"
28
+ LCS_COMPACTION_OPTS = "LeveledCompactionStrategy,sstable_size_in_mb=1"
29
+ UCS_COMPACTION_OPTS = "UnifiedCompactionStrategy"
30
+
27
31
@pytest .fixture (scope = 'function' , autouse = True )
28
32
def fixture_set_cluster_settings (self , fixture_dtest_setup ):
29
33
cluster = fixture_dtest_setup .cluster
@@ -190,16 +194,23 @@ def test_disk_balance_after_boundary_change_stcs(self):
190
194
"""
191
195
@jira_ticket CASSANDRA-13948
192
196
"""
193
- self ._disk_balance_after_boundary_change_test (lcs = False )
197
+ self ._disk_balance_after_boundary_change_test (self . STCS_COMPACTION_OPTS )
194
198
195
199
@since ('3.10' )
196
200
def test_disk_balance_after_boundary_change_lcs (self ):
197
201
"""
198
202
@jira_ticket CASSANDRA-13948
199
203
"""
200
- self ._disk_balance_after_boundary_change_test (lcs = True )
204
+ self ._disk_balance_after_boundary_change_test (self .LCS_COMPACTION_OPTS )
205
+
206
+ @since ('4.0' )
207
+ def test_disk_balance_after_boundary_change_ucs (self ):
208
+ """
209
+ @jira_ticket CASSANDRA-13948
210
+ """
211
+ self ._disk_balance_after_boundary_change_test (self .UCS_COMPACTION_OPTS )
201
212
202
- def _disk_balance_after_boundary_change_test (self , lcs ):
213
+ def _disk_balance_after_boundary_change_test (self , compaction_opts ):
203
214
"""
204
215
@jira_ticket CASSANDRA-13948
205
216
@@ -230,7 +241,6 @@ def _disk_balance_after_boundary_change_test(self, lcs):
230
241
keys_per_flush = 10000
231
242
keys_to_write = num_flushes * keys_per_flush
232
243
233
- compaction_opts = "LeveledCompactionStrategy,sstable_size_in_mb=1" if lcs else "SizeTieredCompactionStrategy"
234
244
logger .debug ("Writing {} keys in {} flushes (compaction_opts={})" .format (keys_to_write , num_flushes , compaction_opts ))
235
245
total_keys = num_flushes * keys_per_flush
236
246
current_keys = 0
@@ -254,29 +264,36 @@ def _disk_balance_after_boundary_change_test(self, lcs):
254
264
node2 .start (wait_for_binary_proto = True , jvm_args = ["-Dcassandra.migration_task_wait_in_seconds=10" ], set_migration_task = False )
255
265
node2 .flush ()
256
266
257
- self ._assert_balanced_after_boundary_change (node1 , total_keys , lcs )
267
+ self ._assert_balanced_after_boundary_change (node1 , total_keys , compaction_opts )
258
268
259
269
logger .debug ("Decommissioning node1" )
260
270
node1 .decommission ()
261
271
node1 .stop ()
262
272
263
- self ._assert_balanced_after_boundary_change (node2 , total_keys , lcs )
273
+ self ._assert_balanced_after_boundary_change (node2 , total_keys , compaction_opts )
264
274
265
275
@since ('3.10' )
266
276
def test_disk_balance_after_joining_ring_stcs (self ):
267
277
"""
268
278
@jira_ticket CASSANDRA-13948
269
279
"""
270
- self ._disk_balance_after_joining_ring_test (lcs = False )
280
+ self ._disk_balance_after_joining_ring_test (self . STCS_COMPACTION_OPTS )
271
281
272
282
@since ('3.10' )
273
283
def test_disk_balance_after_joining_ring_lcs (self ):
274
284
"""
275
285
@jira_ticket CASSANDRA-13948
276
286
"""
277
- self ._disk_balance_after_joining_ring_test (lcs = True )
287
+ self ._disk_balance_after_joining_ring_test (self .LCS_COMPACTION_OPTS )
288
+
289
+ @since ('4.0' )
290
+ def test_disk_balance_after_joining_ring_ucs (self ):
291
+ """
292
+ @jira_ticket CASSANDRA-13948
293
+ """
294
+ self ._disk_balance_after_joining_ring_test (self .UCS_COMPACTION_OPTS )
278
295
279
- def _disk_balance_after_joining_ring_test (self , lcs ):
296
+ def _disk_balance_after_joining_ring_test (self , compaction_opts ):
280
297
"""
281
298
@jira_ticket CASSANDRA-13948
282
299
@@ -302,7 +319,6 @@ def _disk_balance_after_joining_ring_test(self, lcs):
302
319
keys_per_flush = 10000
303
320
keys_to_write = num_flushes * keys_per_flush
304
321
305
- compaction_opts = "LeveledCompactionStrategy,sstable_size_in_mb=1" if lcs else "SizeTieredCompactionStrategy"
306
322
logger .debug ("Writing {} keys in {} flushes (compaction_opts={})" .format (keys_to_write , num_flushes , compaction_opts ))
307
323
total_keys = num_flushes * keys_per_flush
308
324
current_keys = 0
@@ -327,9 +343,9 @@ def _disk_balance_after_joining_ring_test(self, lcs):
327
343
node1 .nodetool ("join" )
328
344
node1 .nodetool ("join" ) # Need to run join twice - one to join ring, another to leave write survey mode
329
345
330
- self ._assert_balanced_after_boundary_change (node1 , total_keys , lcs )
346
+ self ._assert_balanced_after_boundary_change (node1 , total_keys , compaction_opts )
331
347
332
- def _assert_balanced_after_boundary_change (self , node , total_keys , lcs ):
348
+ def _assert_balanced_after_boundary_change (self , node , total_keys , compaction_opts ):
333
349
logger .debug ("Cleanup {}" .format (node .name ))
334
350
node .cleanup ()
335
351
@@ -351,7 +367,7 @@ def _assert_balanced_after_boundary_change(self, node, total_keys, lcs):
351
367
logger .debug ("Reading data back ({} keys)" .format (total_keys ))
352
368
node .stress (['read' , 'n={}' .format (total_keys ), "no-warmup" , "cl=ALL" , "-pop" , "seq=1...{}" .format (total_keys ), "-rate" , "threads=1" ])
353
369
354
- if lcs :
370
+ if compaction_opts == self . LCS_COMPACTION_OPTS :
355
371
output = grep_sstables_in_each_level (node , "standard1" )
356
372
logger .debug ("SSTables in each level: {}" .format (output ))
357
373
0 commit comments