From 5ae3de74294c78d19f2df92f58a90d0ef9715d3c Mon Sep 17 00:00:00 2001 From: Hongqin-Li Date: Mon, 4 Sep 2023 02:14:31 +0000 Subject: [PATCH] Fix reinitialized max id due to unexpected 4018 from sql read --- src/share/ob_max_id_fetcher.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/share/ob_max_id_fetcher.cpp b/src/share/ob_max_id_fetcher.cpp index 9f3bdc257..cfc154c7e 100755 --- a/src/share/ob_max_id_fetcher.cpp +++ b/src/share/ob_max_id_fetcher.cpp @@ -449,6 +449,7 @@ int ObMaxIdFetcher::fetch_max_id(ObISQLClient &sql_client, const uint64_t tenant ObZone zone; const char *id_name = NULL; const uint64_t exec_tenant_id = ObSchemaUtils::get_exec_tenant_id(tenant_id); + bool no_max_id = false; if (OB_INVALID_ID == tenant_id || !valid_max_id_type(max_id_type)) { ret = OB_INVALID_ARGUMENT; LOG_WARN("invalid argument", K(ret), K(tenant_id), K(max_id_type)); @@ -487,13 +488,20 @@ int ObMaxIdFetcher::fetch_max_id(ObISQLClient &sql_client, const uint64_t tenant } } else { if (OB_ITER_END == ret) { - ret = OB_ENTRY_NOT_EXIST; + no_max_id = true; } else { LOG_WARN("fail to get id", "name", id_name, K(ret)); } } } } + + if (OB_ENTRY_NOT_EXIST == ret) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("4018 not caused by no max id", K(ret)); + } else if (OB_ITER_END == ret && no_max_id) { + ret = OB_ENTRY_NOT_EXIST; + } return ret; }