From 18b5b5be8b4983f97cba2e3b4442e45e1190f576 Mon Sep 17 00:00:00 2001 From: obdev Date: Sun, 31 Jul 2022 20:30:57 +0800 Subject: [PATCH] fix: table api report -4002 when the client request does not include a valid table id --- .../table/ob_table_batch_execute_processor.cpp | 4 +++- src/observer/table/ob_table_execute_processor.cpp | 13 ++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/observer/table/ob_table_batch_execute_processor.cpp b/src/observer/table/ob_table_batch_execute_processor.cpp index 4de5856288..0c9b06b4e2 100644 --- a/src/observer/table/ob_table_batch_execute_processor.cpp +++ b/src/observer/table/ob_table_batch_execute_processor.cpp @@ -150,11 +150,13 @@ int ObTableBatchExecuteP::try_process() { int ret = OB_SUCCESS; const ObTableBatchOperation &batch_operation = arg_.batch_operation_; - uint64_t table_id = arg_.table_id_; + uint64_t table_id = OB_INVALID_ID; bool is_index_supported = true; if (batch_operation.count() <= 0) { ret = OB_INVALID_ARGUMENT; LOG_WARN("no operation in the batch", K(ret)); + } else if (OB_FAIL(get_table_id(arg_.table_name_, arg_.table_id_, table_id))) { + LOG_WARN("failed to get table id", K(ret)); } else if (OB_FAIL(check_table_index_supported(table_id, is_index_supported))) { LOG_WARN("fail to check index supported", K(ret), K(table_id)); } else if (OB_UNLIKELY(!is_index_supported)) { diff --git a/src/observer/table/ob_table_execute_processor.cpp b/src/observer/table/ob_table_execute_processor.cpp index 6d0c86dfb5..b08f8aac0f 100644 --- a/src/observer/table/ob_table_execute_processor.cpp +++ b/src/observer/table/ob_table_execute_processor.cpp @@ -115,9 +115,16 @@ int ObTableApiExecuteP::try_process() uint64_t table_id = arg_.table_id_; bool is_index_supported = true; const ObTableOperation &table_operation = arg_.table_operation_; - if (ObTableOperationType::GET != table_operation.type() && - OB_FAIL(check_table_index_supported(table_id, is_index_supported))) { - LOG_WARN("fail to check index supported", K(ret), K(table_id)); + if (ObTableOperationType::GET != table_operation.type()) { + if (OB_FAIL(get_table_id(arg_.table_name_, arg_.table_id_, table_id))) { + LOG_WARN("failed to get table id", K(ret)); + } else if (OB_FAIL(check_table_index_supported(table_id, is_index_supported))) { + LOG_WARN("fail to check index supported", K(ret), K(table_id)); + } + } + + if (OB_FAIL(ret)) { + // do nothing } else if (OB_UNLIKELY(!is_index_supported)) { ret = OB_NOT_SUPPORTED; LOG_WARN("index type is not supported by table api", K(ret)); -- GitLab