diff --git a/regression-test/suites/query_p0/system/test_query_sys_rowsets.groovy b/regression-test/suites/query_p0/system/test_query_sys_rowsets.groovy index e37356f98e0a46..63f0646bd00318 100644 --- a/regression-test/suites/query_p0/system/test_query_sys_rowsets.groovy +++ b/regression-test/suites/query_p0/system/test_query_sys_rowsets.groovy @@ -28,6 +28,11 @@ suite("test_query_sys_rowsets", "query,p0") { def rowsets_table_name = """ test_query_sys_rowsets.test_query_rowset """ sql """ drop table if exists ${rowsets_table_name} """ + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") + // Use a lower bound before table creation to keep the timestamp filter stable + // across second-level boundary races. + def rowsetFilterStartTime = sdf.format(new Date(System.currentTimeMillis() - 60000L)).toString(); + sql """ create table ${rowsets_table_name}( a int , @@ -39,9 +44,6 @@ suite("test_query_sys_rowsets", "query,p0") { "disable_auto_compaction" = "true" ); """ - - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") - def now = sdf.format(new Date()).toString(); List> rowsets_table_name_tablets = sql """ show tablets from ${rowsets_table_name} """ order_qt_rowsets1 """ select START_VERSION,END_VERSION from information_schema.rowsets where TABLET_ID=${rowsets_table_name_tablets[0][0]} group by START_VERSION,END_VERSION order by START_VERSION,END_VERSION; """ @@ -51,5 +53,5 @@ suite("test_query_sys_rowsets", "query,p0") { sql """ insert into ${rowsets_table_name} values (3,0,"dssadasdsafafdf"); """ order_qt_rowsets3 """ select START_VERSION,END_VERSION from information_schema.rowsets where TABLET_ID=${rowsets_table_name_tablets[0][0]} group by START_VERSION,END_VERSION order by START_VERSION,END_VERSION; """ sql """ insert into ${rowsets_table_name} values (4,0,"abcd"); """ - order_qt_rowsets4 """ select START_VERSION,END_VERSION from information_schema.rowsets where TABLET_ID=${rowsets_table_name_tablets[0][0]} and NEWEST_WRITE_TIMESTAMP>='${now}' group by START_VERSION,END_VERSION order by START_VERSION,END_VERSION; """ -} \ No newline at end of file + order_qt_rowsets4 """ select START_VERSION,END_VERSION from information_schema.rowsets where TABLET_ID=${rowsets_table_name_tablets[0][0]} and NEWEST_WRITE_TIMESTAMP>='${rowsetFilterStartTime}' group by START_VERSION,END_VERSION order by START_VERSION,END_VERSION; """ +} diff --git a/regression-test/suites/query_p0/system/test_query_sys_scan_rowsets.groovy b/regression-test/suites/query_p0/system/test_query_sys_scan_rowsets.groovy index 181ccd894521ce..25fc1bb7529e99 100644 --- a/regression-test/suites/query_p0/system/test_query_sys_scan_rowsets.groovy +++ b/regression-test/suites/query_p0/system/test_query_sys_scan_rowsets.groovy @@ -47,7 +47,10 @@ suite("test_query_sys_scan_rowsets", "query,p0") { """ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") - def now = sdf.format(new Date()).toString(); + // Keep the timestamp filter after the create-table rowset's second-level + // timestamp so rowsets4 consistently excludes version 0-1. + Thread.sleep(1100L) + def rowsetFilterStartTime = sdf.format(new Date()).toString(); def rowsets_table_name_tablets = sql_return_maparray """ show tablets from ${rowsets_table_name}; """ def tablet_id = rowsets_table_name_tablets[0].TabletId @@ -66,5 +69,5 @@ suite("test_query_sys_scan_rowsets", "query,p0") { sql """ insert into ${rowsets_table_name} values (4,0,"abcd"); """ sql """ select * from ${rowsets_table_name}; """ - order_qt_rowsets4 """ select START_VERSION,END_VERSION from information_schema.rowsets where TABLET_ID=${tablet_id} and NEWEST_WRITE_TIMESTAMP>='${now}' group by START_VERSION,END_VERSION order by START_VERSION,END_VERSION; """ + order_qt_rowsets4 """ select START_VERSION,END_VERSION from information_schema.rowsets where TABLET_ID=${tablet_id} and NEWEST_WRITE_TIMESTAMP>='${rowsetFilterStartTime}' group by START_VERSION,END_VERSION order by START_VERSION,END_VERSION; """ } \ No newline at end of file