@@ -202,10 +202,31 @@ public void should_parse_table_options() {
202202 + " AND comment = 'My awesome table'\n "
203203 + " AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy', 'sstable_size_in_mb' : 15 }\n "
204204 + " AND compression = { 'sstable_compression' : 'org.apache.cassandra.io.compress.SnappyCompressor', 'chunk_length_kb' : 128 }\n "
205- + " AND crc_check_chance = 0.5;" , // available from C* 3.0
205+ + " AND crc_check_chance = 0.5\n " // available from C* 3.0
206+ + " AND memtable_flush_period_in_ms = 1000;" ,
206207 keyspace );
207208
208- // older versions
209+ // Cassandra 2.0 +
210+ } else if (version .getMajor () > 1 ) {
211+ cql = String .format ("CREATE TABLE %s.with_options (\n "
212+ + " k text,\n "
213+ + " c1 int,\n "
214+ + " c2 int,\n "
215+ + " i int,\n "
216+ + " PRIMARY KEY (k, c1, c2)\n "
217+ + ") WITH CLUSTERING ORDER BY (c1 DESC, c2 ASC)\n "
218+ + " AND read_repair_chance = 0.5\n "
219+ + " AND dclocal_read_repair_chance = 0.6\n "
220+ + " AND replicate_on_write = true\n "
221+ + " AND gc_grace_seconds = 42\n "
222+ + " AND bloom_filter_fp_chance = 0.01\n "
223+ + " AND caching = 'ALL'\n "
224+ + " AND comment = 'My awesome table'\n "
225+ + " AND compaction = { 'class' : 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy', 'sstable_size_in_mb' : 15 }\n "
226+ + " AND compression = { 'sstable_compression' : 'org.apache.cassandra.io.compress.SnappyCompressor', 'chunk_length_kb' : 128 }\n "
227+ + " AND memtable_flush_period_in_ms = 1000;" ,
228+ keyspace );
229+ // older versions
209230 } else {
210231 cql = String .format ("CREATE TABLE %s.with_options (\n "
211232 + " k text,\n "
@@ -260,6 +281,7 @@ public void should_parse_table_options() {
260281 assertThat (table .getOptions ().getReplicateOnWrite ()).isTrue (); // default
261282 assertThat (table .getOptions ().getCrcCheckChance ()).isEqualTo (0.5 );
262283 assertThat (table .getOptions ().getExtensions ()).isEmpty (); // default
284+ assertThat (table .getOptions ().getMemtableFlushPeriodInMs ()).isEqualTo (1000 );
263285 assertThat (table .asCQLQuery ())
264286 .contains ("read_repair_chance = 0.5" )
265287 .contains ("dclocal_read_repair_chance = 0.6" )
@@ -278,6 +300,7 @@ public void should_parse_table_options() {
278300 .contains ("max_index_interval = 2048" )
279301 .contains ("crc_check_chance = 0.5" )
280302 .contains ("cdc = false" )
303+ .contains ("memtable_flush_period_in_ms = 1000" )
281304 .doesNotContain (" index_interval" )
282305 .doesNotContain ("replicate_on_write" );
283306 // Cassandra 3.0 +
@@ -302,6 +325,7 @@ public void should_parse_table_options() {
302325 assertThat (table .getOptions ().getReplicateOnWrite ()).isTrue (); // default
303326 assertThat (table .getOptions ().getCrcCheckChance ()).isEqualTo (0.5 );
304327 assertThat (table .getOptions ().getExtensions ()).isEmpty (); // default
328+ assertThat (table .getOptions ().getMemtableFlushPeriodInMs ()).isEqualTo (1000 );
305329 assertThat (table .asCQLQuery ())
306330 .contains ("read_repair_chance = 0.5" )
307331 .contains ("dclocal_read_repair_chance = 0.6" )
@@ -319,6 +343,7 @@ public void should_parse_table_options() {
319343 .contains ("min_index_interval = 128" )
320344 .contains ("max_index_interval = 2048" )
321345 .contains ("crc_check_chance = 0.5" )
346+ .contains ("memtable_flush_period_in_ms = 1000" )
322347 .doesNotContain (" index_interval" )
323348 .doesNotContain ("replicate_on_write" )
324349 .doesNotContain ("cdc" ); // 3.8+
@@ -345,6 +370,7 @@ public void should_parse_table_options() {
345370 assertThat (table .getOptions ().getMaxIndexInterval ()).isEqualTo (2048 );
346371 assertThat (table .getOptions ().getReplicateOnWrite ()).isTrue (); // default
347372 assertThat (table .getOptions ().getExtensions ()).isEmpty ();
373+ assertThat (table .getOptions ().getMemtableFlushPeriodInMs ()).isEqualTo (1000 );
348374 assertThat (table .asCQLQuery ())
349375 .contains ("read_repair_chance = 0.5" )
350376 .contains ("dclocal_read_repair_chance = 0.6" )
@@ -361,6 +387,7 @@ public void should_parse_table_options() {
361387 .contains ("speculative_retry = '99.0PERCENTILE'" )
362388 .contains ("min_index_interval = 128" )
363389 .contains ("max_index_interval = 2048" )
390+ .contains ("memtable_flush_period_in_ms = 1000" )
364391 .doesNotContain (" index_interval" )
365392 .doesNotContain ("replicate_on_write" )
366393 .doesNotContain ("cdc" );
@@ -386,6 +413,7 @@ public void should_parse_table_options() {
386413 assertThat (table .getOptions ().getMaxIndexInterval ()).isNull ();
387414 assertThat (table .getOptions ().getReplicateOnWrite ()).isTrue (); // explicitly set
388415 assertThat (table .getOptions ().getExtensions ()).isEmpty ();
416+ assertThat (table .getOptions ().getMemtableFlushPeriodInMs ()).isEqualTo (1000 );
389417 assertThat (table .asCQLQuery ())
390418 .contains ("read_repair_chance = 0.5" )
391419 .contains ("dclocal_read_repair_chance = 0.6" )
@@ -401,6 +429,7 @@ public void should_parse_table_options() {
401429 .contains ("index_interval = 128" )
402430 .contains ("speculative_retry = '99.0PERCENTILE'" )
403431 .contains ("default_time_to_live = 0" )
432+ .contains ("memtable_flush_period_in_ms = 1000" )
404433 .doesNotContain ("min_index_interval" ) // 2.1 +
405434 .doesNotContain ("max_index_interval" ) // 2.1 +
406435 .doesNotContain ("cdc" );
@@ -443,7 +472,8 @@ public void should_parse_table_options() {
443472 .doesNotContain ("max_index_interval" ) // 2.1 +
444473 .doesNotContain ("speculative_retry" ) // 2.0 +
445474 .doesNotContain ("default_time_to_live" ) // 2.0 +
446- .doesNotContain ("cdc" );
475+ .doesNotContain ("cdc" )
476+ .doesNotContain ("memtable_flush_period_in_ms" ); // 2.0 +
447477
448478 }
449479
0 commit comments