fix backup

Signed-off-by: Anvette <anwentao@huawei.com>
This commit is contained in:
Anvette 2024-10-30 17:11:29 +08:00
parent 386669232e
commit a57b4a9075
2 changed files with 6 additions and 1 deletions

View File

@ -966,7 +966,11 @@ napi_value RdbStoreProxy::Backup(napi_env env, napi_callback_info info)
auto exec = [context]() -> int {
CHECK_RETURN_ERR(context->rdbStore != nullptr);
auto rdbStore = std::move(context->rdbStore);
return rdbStore->Backup(context->tableName, context->newKey);
auto res = rdbStore->Backup(context->tableName, context->newKey);
if (res == E_DB_NOT_EXIST) {
return E_OK;
}
return res;
};
auto output = [context](napi_env env, napi_value &result) {
napi_status status = napi_get_undefined(env, &result);

View File

@ -2236,6 +2236,7 @@ std::pair<int32_t, std::shared_ptr<Connection>> RdbStoreImpl::CreateWritableConn
{
auto config = config_;
config.SetHaMode(HAMode::SINGLE);
config.SetCreateNecessary(false);
auto [result, conn] = Connection::Create(config, true);
if (result != E_OK || conn == nullptr) {
LOG_ERROR("create connection failed, err:%{public}d", result);