Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Comment thread
mrhhsg marked this conversation as resolved.

sql """
create table ${rowsets_table_name}(
a int ,
Expand All @@ -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<List<Object>> 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; """
Expand All @@ -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; """
}
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; """
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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; """
}
Loading