Fix print skip locked bug

This commit is contained in:
xianyu-w
2023-07-04 12:42:22 +00:00
committed by ob-robot
parent b723955d55
commit f7ee6bedef

View File

@ -889,6 +889,7 @@ int ObSelectStmtPrinter::print_for_update()
const ObSelectStmt *select_stmt = static_cast<const ObSelectStmt*>(stmt_); const ObSelectStmt *select_stmt = static_cast<const ObSelectStmt*>(stmt_);
bool has_for_update_ = false; bool has_for_update_ = false;
int64_t wait_time = -1; int64_t wait_time = -1;
bool skip_locked = false;
for (int64_t i = 0; OB_SUCC(ret) && i < select_stmt->get_table_size(); ++i) { for (int64_t i = 0; OB_SUCC(ret) && i < select_stmt->get_table_size(); ++i) {
const TableItem *table = NULL; const TableItem *table = NULL;
if (OB_ISNULL(table = select_stmt->get_table_item(i))) { if (OB_ISNULL(table = select_stmt->get_table_item(i))) {
@ -897,6 +898,7 @@ int ObSelectStmtPrinter::print_for_update()
} else if (table->for_update_) { } else if (table->for_update_) {
has_for_update_ = true; has_for_update_ = true;
wait_time = table->for_update_wait_us_; wait_time = table->for_update_wait_us_;
skip_locked = table->skip_locked_;
break; break;
} }
} }
@ -920,6 +922,8 @@ int ObSelectStmtPrinter::print_for_update()
if (OB_SUCC(ret) && wait_time >= 0) { if (OB_SUCC(ret) && wait_time >= 0) {
if (wait_time > 0) { if (wait_time > 0) {
DATA_PRINTF(" wait %lld", wait_time / 1000000LL); DATA_PRINTF(" wait %lld", wait_time / 1000000LL);
} else if (skip_locked) {
DATA_PRINTF(" skip locked");
} else { } else {
DATA_PRINTF(" nowait"); DATA_PRINTF(" nowait");
} }