From 034138adfcd911fcc60ef9569a768273b6332054 Mon Sep 17 00:00:00 2001 From: liangjialing <14196692+liangjialing24@user.noreply.gitee.com> Date: Fri, 2 Aug 2024 10:25:58 +0800 Subject: [PATCH] TicketNo:issue1737 Description:Merge dependent libraries, using libarkdata_db_core instead Team:Others Feature or Bugfix:Bugfix Binary Source:No PrivateCode(Yes/No):No Signed-off-by: liangjialing <14196692+liangjialing24@user.noreply.gitee.com> --- .../gaussdb_rd/src/common/include/grd_api_manager.h | 1 + .../gaussdb_rd/src/common/src/grd_api_manager.cpp | 10 +++++++++- .../gaussdb_rd/src/executor/base/grd_db_api.cpp | 1 + .../distributeddb/storage/src/gaussdb_rd/rd_utils.cpp | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/frameworks/libs/distributeddb/gaussdb_rd/src/common/include/grd_api_manager.h b/frameworks/libs/distributeddb/gaussdb_rd/src/common/include/grd_api_manager.h index 4439fb76de..14b5748b67 100755 --- a/frameworks/libs/distributeddb/gaussdb_rd/src/common/include/grd_api_manager.h +++ b/frameworks/libs/distributeddb/gaussdb_rd/src/common/include/grd_api_manager.h @@ -93,5 +93,6 @@ struct GRD_APIInfo { KVBatchDestory KVBatchDestoryApi = nullptr; }; GRD_APIInfo GetApiInfoInstance(); +void InitApiInfo(const char *configStr); } // namespace DocumentDB #endif // __cplusplus diff --git a/frameworks/libs/distributeddb/gaussdb_rd/src/common/src/grd_api_manager.cpp b/frameworks/libs/distributeddb/gaussdb_rd/src/common/src/grd_api_manager.cpp index 485ec72e5a..4352bf1072 100755 --- a/frameworks/libs/distributeddb/gaussdb_rd/src/common/src/grd_api_manager.cpp +++ b/frameworks/libs/distributeddb/gaussdb_rd/src/common/src/grd_api_manager.cpp @@ -35,6 +35,8 @@ static void *g_library = nullptr; #endif +static bool g_isGmdbLib = false; + namespace DocumentDB { void GRD_DBApiInitCommon(GRD_APIInfo &GRD_DBApiInfo) { @@ -108,11 +110,17 @@ void GRD_DBApiInitEnhance(GRD_APIInfo &GRD_DBApiInfo) #endif } +void InitApiInfo(const char *configStr) +{ + g_isGmdbLib = (configStr != nullptr); +} + GRD_APIInfo GetApiInfoInstance() { GRD_APIInfo GRD_TempApiStruct; #ifndef _WIN32 - g_library = dlopen("libarkdata_db_core.z.so", RTLD_LAZY); + std::string libPath = g_isGmdbLib ? "libarkdata_db_core.z.so" : "libgaussdb_rd.z.so"; + g_library = dlopen(libPath.c_str(), RTLD_LAZY); if (!g_library) { GRD_DBApiInitCommon(GRD_TempApiStruct); // When calling specific function, read whether init is successful. } else { diff --git a/frameworks/libs/distributeddb/gaussdb_rd/src/executor/base/grd_db_api.cpp b/frameworks/libs/distributeddb/gaussdb_rd/src/executor/base/grd_db_api.cpp index 6f5907d95e..931b070d43 100644 --- a/frameworks/libs/distributeddb/gaussdb_rd/src/executor/base/grd_db_api.cpp +++ b/frameworks/libs/distributeddb/gaussdb_rd/src/executor/base/grd_db_api.cpp @@ -28,6 +28,7 @@ static GRD_APIInfo GRD_DBApiInfo; GRD_API int32_t GRD_DBOpen(const char *dbPath, const char *configStr, uint32_t flags, GRD_DB **db) { if (GRD_DBApiInfo.DBOpenApi == nullptr) { + InitApiInfo(configStr); GRD_DBApiInfo = GetApiInfoInstance(); } if (GRD_DBApiInfo.DBOpenApi == nullptr) { diff --git a/frameworks/libs/distributeddb/storage/src/gaussdb_rd/rd_utils.cpp b/frameworks/libs/distributeddb/storage/src/gaussdb_rd/rd_utils.cpp index 57ded4016f..527908ba3a 100755 --- a/frameworks/libs/distributeddb/storage/src/gaussdb_rd/rd_utils.cpp +++ b/frameworks/libs/distributeddb/storage/src/gaussdb_rd/rd_utils.cpp @@ -50,7 +50,7 @@ namespace DistributedDB { std::string InitRdConfig() { - return R"("redoFlushByTrx": 1, "maxConnNum": 100, "crcCheckEnable": 0)"; + return R"("redoFlushByTrx": 1, "maxConnNum": 100, "crcCheckEnable": 0, "metaInfoBak": 1)"; } struct GrdErrnoPair { -- Gitee