Skip to content
Open
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
26 changes: 24 additions & 2 deletions regression-test/suites/inverted_index_p2/test_show_data.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,26 @@ suite("test_show_data_with_compaction", "p2") {
return data_size
}

def assert_show_data_size_close = { left_size, right_size, desc ->
double diff = Math.abs(left_size.toDouble() - right_size.toDouble())
double max_size = Math.max(left_size.toDouble(), right_size.toDouble())
double diff_ratio = diff / max_size
logger.info("{} show data size diff is {}, diff ratio is {}", desc, diff, diff_ratio)
assertTrue(diff_ratio < 0.15d,
"${desc} show data size diff ratio ${diff_ratio} should be less than 15%, " +
"diff: ${diff} KB, left size: ${left_size}, right size: ${right_size}")
}

def assert_documents_show_data_size_in_range = { data_size, desc ->
double size = data_size.toDouble()
double min_size = isCloudMode() ? 55.0d : 170.0d
double max_size = isCloudMode() ? 70.0d : 200.0d
logger.info("{} show data size is {}, expected range is [{}, {}], isCloudMode: {}",
desc, size, min_size, max_size, isCloudMode())
assertTrue(size >= min_size && size <= max_size,
"${desc} show data size ${size} KB should be in [${min_size}, ${max_size}] KB")
}

try {

set_be_config.call("inverted_index_compaction_enable", "true")
Expand Down Expand Up @@ -813,7 +833,9 @@ suite("test_show_data_with_compaction", "p2") {
assertTrue(another_with_index_size != "wait_timeout")

logger.info("with_index_size is {}, another_with_index_size is {}", with_index_size, another_with_index_size)
assertEquals(another_with_index_size, with_index_size)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still needs to compare the two config paths. The old assertion checked that the table compacted with inverted_index_compaction_enable=true reported the same SHOW DATA size as the table compacted with the config disabled. After this change, each value is only checked against an independent range, so a regression like 170 KB vs 200 KB in non-cloud mode, or 55 KB vs 70 KB in cloud mode, would pass even though the two implementations disagree materially. Please keep the absolute sanity range if it is needed for cloud/non-cloud variance, but also compare with_index_size and another_with_index_size with a relative tolerance, for example by reusing assert_show_data_size_close for the documents table.

assert_documents_show_data_size_in_range.call(with_index_size, "documents table with inverted index compaction")
assert_documents_show_data_size_in_range.call(another_with_index_size, "documents table without inverted index compaction")
assert_show_data_size_close.call(with_index_size, another_with_index_size, "documents table")

set_be_config.call("inverted_index_compaction_enable", "true")

Expand All @@ -824,7 +846,7 @@ suite("test_show_data_with_compaction", "p2") {
def data_size_2 = create_table_run_compaction_and_wait(tableName)

logger.info("data_size_1 is {}, data_size_2 is {}", data_size_1, data_size_2)
assertEquals(data_size_1, data_size_2)
assert_show_data_size_close.call(data_size_1, data_size_2, "insert table")

} finally {
// sql "DROP TABLE IF EXISTS ${tableWithIndexCompaction}"
Expand Down
Loading