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 4439fb76deebac0c0e44382014adfa7c4081f2e2..14b5748b679efdc4623ada7a57773472c0c65c5d 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 485ec72e5aa652e00f523fac10bb4e38e429fc89..4352bf1072de49cb2fa29fafb60dea71e66f5119 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 6f5907d95efdf9fb2eaf55a078a0696c3c80c48e..931b070d43ef3bfdd669c9be2128b4d349a3ca0c 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 57ded4016f0152405c0d1eb5fc98cae979a5f2db..527908ba3aa4c9a91cf7347eb1e7fb6beb5bcbad 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 {