@@ -194,8 +194,8 @@ private void invalidationResultSetTest(
194194 Consumer <CqlSession > setupTestSchema , Set <String > expectedChangedTypes ) {
195195 invalidationTestInner (
196196 setupTestSchema ,
197- "select f from test_table_1 where e = ?" ,
198- "select h from test_table_2 where g = ?" ,
197+ "select f from test_table_caching_1 where e = ?" ,
198+ "select h from test_table_caching_2 where g = ?" ,
199199 expectedChangedTypes );
200200 }
201201
@@ -206,8 +206,8 @@ private void invalidationVariableDefsTest(
206206 String condition = isCollection ? "contains ?" : "= ?" ;
207207 invalidationTestInner (
208208 setupTestSchema ,
209- String .format ("select e from test_table_1 where f %s allow filtering" , condition ),
210- String .format ("select g from test_table_2 where h %s allow filtering" , condition ),
209+ String .format ("select e from test_table_caching_1 where f %s allow filtering" , condition ),
210+ String .format ("select g from test_table_caching_2 where h %s allow filtering" , condition ),
211211 expectedChangedTypes );
212212 }
213213
@@ -263,16 +263,18 @@ private void invalidationTestInner(
263263 preparedStmtCacheRemoveLatch .countDown ();
264264 });
265265
266- // alter test_type_2 to trigger cache invalidation and above events
267- session .execute ("ALTER TYPE test_type_2 add i blob" );
266+ // alter test_type_caching_2 to trigger cache invalidation and above events
267+ session .execute ("ALTER TYPE test_type_caching_2 add i blob" );
268+
269+ session .checkSchemaAgreement ();
268270
269271 // wait for latches and fail if they don't reach zero before timeout
270272 assertThat (
271273 Uninterruptibles .awaitUninterruptibly (
272- preparedStmtCacheRemoveLatch , 10 , TimeUnit .SECONDS ))
274+ preparedStmtCacheRemoveLatch , 120 , TimeUnit .SECONDS ))
273275 .withFailMessage ("preparedStmtCacheRemoveLatch did not trigger before timeout" )
274276 .isTrue ();
275- assertThat (Uninterruptibles .awaitUninterruptibly (typeChangeEventLatch , 10 , TimeUnit .SECONDS ))
277+ assertThat (Uninterruptibles .awaitUninterruptibly (typeChangeEventLatch , 20 , TimeUnit .SECONDS ))
276278 .withFailMessage ("typeChangeEventLatch did not trigger before timeout" )
277279 .isTrue ();
278280
@@ -295,17 +297,20 @@ private void invalidationTestInner(
295297
296298 Consumer <CqlSession > setupCacheEntryTestBasic =
297299 (session ) -> {
298- session .execute ("CREATE TYPE test_type_1 (a text, b int)" );
299- session .execute ("CREATE TYPE test_type_2 (c int, d text)" );
300- session .execute ("CREATE TABLE test_table_1 (e int primary key, f frozen<test_type_1>)" );
301- session .execute ("CREATE TABLE test_table_2 (g int primary key, h frozen<test_type_2>)" );
300+ session .execute ("CREATE TYPE test_type_caching_1 (a text, b int)" );
301+ session .execute ("CREATE TYPE test_type_caching_2 (c int, d text)" );
302+ session .execute (
303+ "CREATE TABLE test_table_caching_1 (e int primary key, f frozen<test_type_caching_1>)" );
304+ session .execute (
305+ "CREATE TABLE test_table_caching_2 (g int primary key, h frozen<test_type_caching_2>)" );
302306 };
303307
304308 @ Test
305309 public void should_invalidate_cache_entry_on_basic_udt_change_result_set () {
306310 SchemaChangeSynchronizer .withLock (
307311 () -> {
308- invalidationResultSetTest (setupCacheEntryTestBasic , ImmutableSet .of ("test_type_2" ));
312+ invalidationResultSetTest (
313+ setupCacheEntryTestBasic , ImmutableSet .of ("test_type_caching_2" ));
309314 });
310315 }
311316
@@ -314,25 +319,26 @@ public void should_invalidate_cache_entry_on_basic_udt_change_variable_defs() {
314319 SchemaChangeSynchronizer .withLock (
315320 () -> {
316321 invalidationVariableDefsTest (
317- setupCacheEntryTestBasic , false , ImmutableSet .of ("test_type_2 " ));
322+ setupCacheEntryTestBasic , false , ImmutableSet .of ("test_type_caching_2 " ));
318323 });
319324 }
320325
321326 Consumer <CqlSession > setupCacheEntryTestCollection =
322327 (session ) -> {
323- session .execute ("CREATE TYPE test_type_1 (a text, b int)" );
324- session .execute ("CREATE TYPE test_type_2 (c int, d text)" );
328+ session .execute ("CREATE TYPE test_type_caching_1 (a text, b int)" );
329+ session .execute ("CREATE TYPE test_type_caching_2 (c int, d text)" );
325330 session .execute (
326- "CREATE TABLE test_table_1 (e int primary key, f list<frozen<test_type_1 >>)" );
331+ "CREATE TABLE test_table_caching_1 (e int primary key, f list<frozen<test_type_caching_1 >>)" );
327332 session .execute (
328- "CREATE TABLE test_table_2 (g int primary key, h list<frozen<test_type_2 >>)" );
333+ "CREATE TABLE test_table_caching_2 (g int primary key, h list<frozen<test_type_caching_2 >>)" );
329334 };
330335
331336 @ Test
332337 public void should_invalidate_cache_entry_on_collection_udt_change_result_set () {
333338 SchemaChangeSynchronizer .withLock (
334339 () -> {
335- invalidationResultSetTest (setupCacheEntryTestCollection , ImmutableSet .of ("test_type_2" ));
340+ invalidationResultSetTest (
341+ setupCacheEntryTestCollection , ImmutableSet .of ("test_type_caching_2" ));
336342 });
337343 }
338344
@@ -341,25 +347,26 @@ public void should_invalidate_cache_entry_on_collection_udt_change_variable_defs
341347 SchemaChangeSynchronizer .withLock (
342348 () -> {
343349 invalidationVariableDefsTest (
344- setupCacheEntryTestCollection , true , ImmutableSet .of ("test_type_2 " ));
350+ setupCacheEntryTestCollection , true , ImmutableSet .of ("test_type_caching_2 " ));
345351 });
346352 }
347353
348354 Consumer <CqlSession > setupCacheEntryTestTuple =
349355 (session ) -> {
350- session .execute ("CREATE TYPE test_type_1 (a text, b int)" );
351- session .execute ("CREATE TYPE test_type_2 (c int, d text)" );
356+ session .execute ("CREATE TYPE test_type_caching_1 (a text, b int)" );
357+ session .execute ("CREATE TYPE test_type_caching_2 (c int, d text)" );
352358 session .execute (
353- "CREATE TABLE test_table_1 (e int primary key, f tuple<int, test_type_1 , text>)" );
359+ "CREATE TABLE test_table_caching_1 (e int primary key, f tuple<int, test_type_caching_1 , text>)" );
354360 session .execute (
355- "CREATE TABLE test_table_2 (g int primary key, h tuple<text, test_type_2 , int>)" );
361+ "CREATE TABLE test_table_caching_2 (g int primary key, h tuple<text, test_type_caching_2 , int>)" );
356362 };
357363
358364 @ Test
359365 public void should_invalidate_cache_entry_on_tuple_udt_change_result_set () {
360366 SchemaChangeSynchronizer .withLock (
361367 () -> {
362- invalidationResultSetTest (setupCacheEntryTestTuple , ImmutableSet .of ("test_type_2" ));
368+ invalidationResultSetTest (
369+ setupCacheEntryTestTuple , ImmutableSet .of ("test_type_caching_2" ));
363370 });
364371 }
365372
@@ -368,26 +375,29 @@ public void should_invalidate_cache_entry_on_tuple_udt_change_variable_defs() {
368375 SchemaChangeSynchronizer .withLock (
369376 () -> {
370377 invalidationVariableDefsTest (
371- setupCacheEntryTestTuple , false , ImmutableSet .of ("test_type_2 " ));
378+ setupCacheEntryTestTuple , false , ImmutableSet .of ("test_type_caching_2 " ));
372379 });
373380 }
374381
375382 Consumer <CqlSession > setupCacheEntryTestNested =
376383 (session ) -> {
377- session .execute ("CREATE TYPE test_type_1 (a text, b int)" );
378- session .execute ("CREATE TYPE test_type_2 (c int, d text)" );
379- session .execute ("CREATE TYPE test_type_3 (e frozen<test_type_1>, f int)" );
380- session .execute ("CREATE TYPE test_type_4 (g int, h frozen<test_type_2>)" );
381- session .execute ("CREATE TABLE test_table_1 (e int primary key, f frozen<test_type_3>)" );
382- session .execute ("CREATE TABLE test_table_2 (g int primary key, h frozen<test_type_4>)" );
384+ session .execute ("CREATE TYPE test_type_caching_1 (a text, b int)" );
385+ session .execute ("CREATE TYPE test_type_caching_2 (c int, d text)" );
386+ session .execute ("CREATE TYPE test_type_caching_3 (e frozen<test_type_caching_1>, f int)" );
387+ session .execute ("CREATE TYPE test_type_caching_4 (g int, h frozen<test_type_caching_2>)" );
388+ session .execute (
389+ "CREATE TABLE test_table_caching_1 (e int primary key, f frozen<test_type_caching_3>)" );
390+ session .execute (
391+ "CREATE TABLE test_table_caching_2 (g int primary key, h frozen<test_type_caching_4>)" );
383392 };
384393
385394 @ Test
386395 public void should_invalidate_cache_entry_on_nested_udt_change_result_set () {
387396 SchemaChangeSynchronizer .withLock (
388397 () -> {
389398 invalidationResultSetTest (
390- setupCacheEntryTestNested , ImmutableSet .of ("test_type_2" , "test_type_4" ));
399+ setupCacheEntryTestNested ,
400+ ImmutableSet .of ("test_type_caching_2" , "test_type_caching_4" ));
391401 });
392402 }
393403
@@ -396,7 +406,9 @@ public void should_invalidate_cache_entry_on_nested_udt_change_variable_defs() {
396406 SchemaChangeSynchronizer .withLock (
397407 () -> {
398408 invalidationVariableDefsTest (
399- setupCacheEntryTestNested , false , ImmutableSet .of ("test_type_2" , "test_type_4" ));
409+ setupCacheEntryTestNested ,
410+ false ,
411+ ImmutableSet .of ("test_type_caching_2" , "test_type_caching_4" ));
400412 });
401413 }
402414
0 commit comments