From 304544f46fbe12de0de5c23e6fa53b7a89c81da7 Mon Sep 17 00:00:00 2001 From: YoungYang0820 Date: Mon, 7 Nov 2022 05:08:01 +0000 Subject: [PATCH] add retry when tablet autoinc seq -4023 --- src/share/ob_tablet_autoincrement_service.cpp | 2 ++ src/share/ob_tablet_autoincrement_service.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/share/ob_tablet_autoincrement_service.cpp b/src/share/ob_tablet_autoincrement_service.cpp index 3ac0f9fa1..eb535935a 100644 --- a/src/share/ob_tablet_autoincrement_service.cpp +++ b/src/share/ob_tablet_autoincrement_service.cpp @@ -252,6 +252,8 @@ int ObTabletAutoincrementService::get_autoinc_seq(const uint64_t tenant_id, cons } if (OB_SUCC(ret)) { ObTabletCacheInterval interval(tablet_id, 1/*cache size*/); + lib::ObMutex &mutex = init_node_mutexs_[tablet_id.id() % INIT_NODE_MUTEX_NUM]; + lib::ObMutexGuard guard(mutex); if (OB_ISNULL(autoinc_mgr)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("autoinc mgr is unexpected null", K(ret)); diff --git a/src/share/ob_tablet_autoincrement_service.h b/src/share/ob_tablet_autoincrement_service.h index 7dec29725..6b63a5935 100644 --- a/src/share/ob_tablet_autoincrement_service.h +++ b/src/share/ob_tablet_autoincrement_service.h @@ -110,7 +110,7 @@ private: private: typedef common::ObLinkHashMap TabletAutoincMgrMap; - const static int INIT_NODE_MUTEX_NUM = 1024; + const static int INIT_NODE_MUTEX_NUM = 10243L; bool is_inited_; common::ObSmallAllocator node_allocator_; TabletAutoincMgrMap tablet_autoinc_mgr_map_; -- GitLab