mirror of
https://gitee.com/openharmony/distributeddatamgr_relational_store
synced 2024-11-23 07:00:41 +00:00
fix:多线程场景下,文件锁失效
Signed-off-by: 邓俊 <dengjun39@huawei.com>
This commit is contained in:
parent
71fa7555ab
commit
bdc2a9f9a3
@ -77,6 +77,7 @@ using RdbMgr = DistributedRdb::RdbManagerImpl;
|
||||
static constexpr const char *BEGIN_TRANSACTION_SQL = "begin;";
|
||||
static constexpr const char *COMMIT_TRANSACTION_SQL = "commit;";
|
||||
static constexpr const char *ROLLBACK_TRANSACTION_SQL = "rollback;";
|
||||
static constexpr const char *BACKUP_RESTORE = "backup.restore";
|
||||
constexpr int64_t TIME_OUT = 1500;
|
||||
|
||||
void RdbStoreImpl::InitSyncerParam(const RdbStoreConfig &config, bool created)
|
||||
@ -1429,7 +1430,7 @@ int RdbStoreImpl::Backup(const std::string &databasePath, const std::vector<uint
|
||||
return ret;
|
||||
}
|
||||
|
||||
RdbSecurityManager::KeyFiles keyFiles(backupFilePath);
|
||||
RdbSecurityManager::KeyFiles keyFiles(path_ + BACKUP_RESTORE);
|
||||
keyFiles.Lock();
|
||||
|
||||
auto deleteDirtyFiles = [&backupFilePath] {
|
||||
@ -2196,10 +2197,10 @@ int RdbStoreImpl::Restore(const std::string &backupPath, const std::vector<uint8
|
||||
return E_ERROR;
|
||||
}
|
||||
|
||||
RdbSecurityManager::KeyFiles keyFiles(path_ + BACKUP_RESTORE);
|
||||
keyFiles.Lock();
|
||||
std::string destPath;
|
||||
bool isOK = TryGetMasterSlaveBackupPath(backupPath, destPath, true);
|
||||
RdbSecurityManager::KeyFiles keyFiles(destPath);
|
||||
keyFiles.Lock();
|
||||
if (!isOK) {
|
||||
int ret = GetDestPath(backupPath, destPath);
|
||||
if (ret != E_OK) {
|
||||
|
Loading…
Reference in New Issue
Block a user