Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(test)[regression-test]: trigger compaction with table_name instead of tablets #45957

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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 @@ -54,7 +54,7 @@ suite("test_partial_update_compaction_with_higher_version", "nonConcurrent") {
}
logger.info("tablet ${tabletId} on backend ${tabletBackend.Host} with backendId=${tabletBackend.BackendId}");

def check_rs_metas = { expected_rs_meta_size, check_func ->
def check_rs_metas = { expected_rs_meta_size, check_func ->
if (isCloudMode()) {
return
}
Expand Down Expand Up @@ -88,7 +88,7 @@ suite("test_partial_update_compaction_with_higher_version", "nonConcurrent") {
}
})

def enable_publish_spin_wait = { tokenName ->
def enable_publish_spin_wait = { tokenName ->
if (isCloudMode()) {
GetDebugPoint().enableDebugPointForAllFEs("CloudGlobalTransactionMgr.getDeleteBitmapUpdateLock.enable_spin_wait", [token: "${tokenName}"])
} else {
Expand All @@ -104,7 +104,7 @@ suite("test_partial_update_compaction_with_higher_version", "nonConcurrent") {
}
}

def enable_block_in_publish = { passToken ->
def enable_block_in_publish = { passToken ->
if (isCloudMode()) {
GetDebugPoint().enableDebugPointForAllFEs("CloudGlobalTransactionMgr.getDeleteBitmapUpdateLock.block", [pass_token: "${passToken}"])
} else {
Expand Down Expand Up @@ -209,7 +209,7 @@ suite("test_partial_update_compaction_with_higher_version", "nonConcurrent") {
Assert.assertEquals(numRows, 4) // 4 = 2 + 2
}
})

} catch(Exception e) {
logger.info(e.getMessage())
throw e
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,49 +36,6 @@ suite("test_index_compaction_exception_fault_injection", "nonConcurrent") {
}
}

def trigger_full_compaction_on_tablets = { tablets ->
for (def tablet : tablets) {
String tablet_id = tablet.TabletId
String backend_id = tablet.BackendId
int times = 1

String compactionStatus;
do{
def (code, out, err) = be_run_full_compaction(backendId_to_backendIP.get(backend_id), backendId_to_backendHttpPort.get(backend_id), tablet_id)
logger.info("Run compaction: code=" + code + ", out=" + out + ", err=" + err)
++times
sleep(2000)
compactionStatus = parseJson(out.trim()).status.toLowerCase();
} while (compactionStatus!="success" && times<=10 && compactionStatus!="e-6010")


if (compactionStatus == "fail") {
assertEquals(disableAutoCompaction, false)
logger.info("Compaction was done automatically!")
}
if (disableAutoCompaction && compactionStatus!="e-6010") {
assertEquals("success", compactionStatus)
}
}
}

def wait_full_compaction_done = { tablets ->
for (def tablet in tablets) {
boolean running = true
do {
Thread.sleep(1000)
String tablet_id = tablet.TabletId
String backend_id = tablet.BackendId
def (code, out, err) = be_get_compaction_status(backendId_to_backendIP.get(backend_id), backendId_to_backendHttpPort.get(backend_id), tablet_id)
logger.info("Get compaction status: code=" + code + ", out=" + out + ", err=" + err)
assertEquals(code, 0)
def compactionStatus = parseJson(out.trim())
assertEquals("success", compactionStatus.status.toLowerCase())
running = compactionStatus.run_status
} while (running)
}
}

def get_rowset_count = { tablets ->
int rowsetCount = 0
for (def tablet in tablets) {
Expand Down Expand Up @@ -201,7 +158,7 @@ suite("test_index_compaction_exception_fault_injection", "nonConcurrent") {
"Compaction::construct_skip_inverted_index_index_file_reader_open_error"
]

def run_test = { tablets, debug_point, abnormal ->
def run_test = { tablets, debug_point, abnormal, table_name ->
insert_data.call()

run_sql.call()
Expand All @@ -226,8 +183,7 @@ suite("test_index_compaction_exception_fault_injection", "nonConcurrent") {
try {
GetDebugPoint().enableDebugPointForAllBEs(debug_point)
logger.info("trigger_full_compaction_on_tablets with fault injection: ${debug_point}")
trigger_full_compaction_on_tablets.call(tablets)
wait_full_compaction_done.call(tablets)
trigger_and_wait_compaction(table_name, "full")
} finally {
GetDebugPoint().disableDebugPointForAllBEs(debug_point)
}
Expand All @@ -240,10 +196,7 @@ suite("test_index_compaction_exception_fault_injection", "nonConcurrent") {
logger.info("trigger_full_compaction_on_tablets normally")
// trigger full compactions for all tablets in ${tableName}
// this time, index compaction of some columns will be skipped because of the fault injection
trigger_full_compaction_on_tablets.call(tablets)

// wait for full compaction done
wait_full_compaction_done.call(tablets)
trigger_and_wait_compaction(table_name, "full")
}

// after full compaction, there is only 1 rowset.
Expand Down Expand Up @@ -291,7 +244,7 @@ suite("test_index_compaction_exception_fault_injection", "nonConcurrent") {
"""

def tablets = sql_return_maparray """ show tablets from ${table_name}; """
run_test.call(tablets, debug_point, is_abnormal)
run_test.call(tablets, debug_point, is_abnormal, table_name)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,57 +25,14 @@ suite("test_index_compaction_failure_injection", "nonConcurrent") {
getBackendIpHttpPort(backendId_to_backendIP, backendId_to_backendHttpPort);

boolean disableAutoCompaction = false

def set_be_config = { key, value ->
for (String backend_id: backendId_to_backendIP.keySet()) {
def (code, out, err) = update_be_config(backendId_to_backendIP.get(backend_id), backendId_to_backendHttpPort.get(backend_id), key, value)
logger.info("update config: code=" + code + ", out=" + out + ", err=" + err)
}
}

def trigger_full_compaction_on_tablets = { tablets ->
for (def tablet : tablets) {
String tablet_id = tablet.TabletId
String backend_id = tablet.BackendId
int times = 1

String compactionStatus;
do{
def (code, out, err) = be_run_full_compaction(backendId_to_backendIP.get(backend_id), backendId_to_backendHttpPort.get(backend_id), tablet_id)
logger.info("Run compaction: code=" + code + ", out=" + out + ", err=" + err)
++times
sleep(2000)
compactionStatus = parseJson(out.trim()).status.toLowerCase();
} while (compactionStatus!="success" && times<=10 && compactionStatus!="e-6010")


if (compactionStatus == "fail") {
assertEquals(disableAutoCompaction, false)
logger.info("Compaction was done automatically!")
}
if (disableAutoCompaction && compactionStatus!="e-6010") {
assertEquals("success", compactionStatus)
}
}
}

def wait_full_compaction_done = { tablets ->
for (def tablet in tablets) {
boolean running = true
do {
Thread.sleep(1000)
String tablet_id = tablet.TabletId
String backend_id = tablet.BackendId
def (code, out, err) = be_get_compaction_status(backendId_to_backendIP.get(backend_id), backendId_to_backendHttpPort.get(backend_id), tablet_id)
logger.info("Get compaction status: code=" + code + ", out=" + out + ", err=" + err)
assertEquals(code, 0)
def compactionStatus = parseJson(out.trim())
assertEquals("success", compactionStatus.status.toLowerCase())
running = compactionStatus.run_status
} while (running)
}
}

def get_rowset_count = { tablets ->
int rowsetCount = 0
for (def tablet in tablets) {
Expand Down Expand Up @@ -105,7 +62,7 @@ suite("test_index_compaction_failure_injection", "nonConcurrent") {
}
}

def insert_data = { ->
def insert_data = { ->
sql """ INSERT INTO ${tableName} VALUES (1, "andy", "andy love apple", 100); """
sql """ INSERT INTO ${tableName} VALUES (1, "bason", "bason hate pear", 99); """
sql """ INSERT INTO ${tableName} VALUES (2, "andy", "andy love apple", 100); """
Expand All @@ -114,14 +71,14 @@ suite("test_index_compaction_failure_injection", "nonConcurrent") {
sql """ INSERT INTO ${tableName} VALUES (3, "bason", "bason hate pear", 99); """
}

def run_sql = { ->
def run_sql = { ->
qt_sql """ select * from ${tableName} order by id, name, hobbies, score """
qt_sql """ select * from ${tableName} where name match "andy" order by id, name, hobbies, score """
qt_sql """ select * from ${tableName} where hobbies match "pear" order by id, name, hobbies, score """
qt_sql """ select * from ${tableName} where score < 100 order by id, name, hobbies, score """
}

def run_test = { tablets ->
def run_test = { tablets, table_name ->
insert_data.call()

run_sql.call()
Expand All @@ -143,8 +100,7 @@ suite("test_index_compaction_failure_injection", "nonConcurrent") {
try {
GetDebugPoint().enableDebugPointForAllBEs("index_compaction_compact_column_throw_error")
logger.info("trigger_full_compaction_on_tablets with fault injection: index_compaction_compact_column_throw_error")
trigger_full_compaction_on_tablets.call(tablets)
wait_full_compaction_done.call(tablets)
trigger_and_wait_compaction(table_name, "full")
} finally {
GetDebugPoint().disableDebugPointForAllBEs("index_compaction_compact_column_throw_error")
}
Expand All @@ -155,10 +111,7 @@ suite("test_index_compaction_failure_injection", "nonConcurrent") {
logger.info("trigger_full_compaction_on_tablets normally")
// trigger full compactions for all tablets in ${tableName}
// this time, index compaction of some columns will be skipped because of the fault injection
trigger_full_compaction_on_tablets.call(tablets)

// wait for full compaction done
wait_full_compaction_done.call(tablets)
trigger_and_wait_compaction(table_name, "full")

// after full compaction, there is only 1 rowset.
rowsetCount = get_rowset_count.call(tablets);
Expand Down Expand Up @@ -187,8 +140,7 @@ suite("test_index_compaction_failure_injection", "nonConcurrent") {
try {
GetDebugPoint().enableDebugPointForAllBEs("index_compaction_compact_column_status_not_ok")
logger.info("trigger_full_compaction_on_tablets with fault injection: index_compaction_compact_column_status_not_ok")
trigger_full_compaction_on_tablets.call(tablets)
wait_full_compaction_done.call(tablets)
trigger_and_wait_compaction(table_name, "full")
} finally {
GetDebugPoint().disableDebugPointForAllBEs("index_compaction_compact_column_status_not_ok")
}
Expand All @@ -210,10 +162,7 @@ suite("test_index_compaction_failure_injection", "nonConcurrent") {
logger.info("trigger_full_compaction_on_tablets normally")
// trigger full compactions for all tablets in ${tableName}
// this time, index compaction of some columns will be skipped because of the fault injection
trigger_full_compaction_on_tablets.call(tablets)

// wait for full compaction done
wait_full_compaction_done.call(tablets)
trigger_and_wait_compaction(table_name, "full")

// after full compaction, there is only 1 rowset.
rowsetCount = get_rowset_count.call(tablets);
Expand All @@ -227,7 +176,7 @@ suite("test_index_compaction_failure_injection", "nonConcurrent") {

// insert more data and trigger full compaction again
insert_data.call()

sql """ select * from ${tableName} """

// insert 6 rows, so there are 7 rowsets.
Expand All @@ -240,10 +189,7 @@ suite("test_index_compaction_failure_injection", "nonConcurrent") {
// tigger full compaction for all tablets normally
// this time, index compaction will be done successfully
logger.info("trigger_full_compaction_on_tablets normally")
trigger_full_compaction_on_tablets.call(tablets)

// wait for full compaction done
wait_full_compaction_done.call(tablets)
trigger_and_wait_compaction(table_name, "full")

// after full compaction, there is only 1 rowset.
rowsetCount = get_rowset_count.call(tablets);
Expand All @@ -262,7 +208,7 @@ suite("test_index_compaction_failure_injection", "nonConcurrent") {
String backend_id;
backend_id = backendId_to_backendIP.keySet()[0]
def (code, out, err) = show_be_config(backendId_to_backendIP.get(backend_id), backendId_to_backendHttpPort.get(backend_id))

logger.info("Show config: code=" + code + ", out=" + out + ", err=" + err)
assertEquals(code, 0)
def configList = parseJson(out.trim())
Expand Down Expand Up @@ -308,7 +254,7 @@ suite("test_index_compaction_failure_injection", "nonConcurrent") {
//TabletId,ReplicaId,BackendId,SchemaHash,Version,LstSuccessVersion,LstFailedVersion,LstFailedTime,LocalDataSize,RemoteDataSize,RowCount,State,LstConsistencyCheckTime,CheckVersion,VersionCount,PathHash,MetaUrl,CompactionStatus
def tablets = sql_return_maparray """ show tablets from ${tableName}; """

run_test.call(tablets)
run_test.call(tablets, tableName)

/**
* test for unique key table
Expand All @@ -329,7 +275,7 @@ suite("test_index_compaction_failure_injection", "nonConcurrent") {
UNIQUE KEY(`id`)
COMMENT 'OLAP'
DISTRIBUTED BY HASH(`id`) BUCKETS 1
PROPERTIES (
PROPERTIES (
"replication_num" = "1",
"disable_auto_compaction" = "true",
"enable_unique_key_merge_on_write" = "true",
Expand All @@ -338,7 +284,7 @@ suite("test_index_compaction_failure_injection", "nonConcurrent") {
"""

tablets = sql_return_maparray """ show tablets from ${tableName}; """
run_test.call(tablets)
run_test.call(tablets, tableName)

} finally {
if (has_update_be_config) {
Expand Down
Loading
Loading