mirror of
https://gitee.com/openharmony/distributeddatamgr_relational_store
synced 2024-11-27 01:01:02 +00:00
codecheck
Signed-off-by: lobty <butaoyu@huawei.com>
This commit is contained in:
parent
051137ac77
commit
b4fe77bfff
@ -149,7 +149,6 @@ private:
|
||||
static constexpr uint32_t DB_INDEX = 0;
|
||||
static constexpr uint32_t WAL_INDEX = 2;
|
||||
static constexpr uint32_t ITER_V1 = 5000;
|
||||
static constexpr uint32_t ITERS_COUNT = 2;
|
||||
static const int32_t regCreator_;
|
||||
static const int32_t regRepairer_;
|
||||
static const int32_t regDeleter_;
|
||||
|
@ -68,7 +68,6 @@ constexpr uint32_t SqliteConnection::NO_ITER;
|
||||
constexpr uint32_t SqliteConnection::DB_INDEX;
|
||||
constexpr uint32_t SqliteConnection::WAL_INDEX;
|
||||
constexpr uint32_t SqliteConnection::ITER_V1;
|
||||
constexpr uint32_t SqliteConnection::ITERS_COUNT;
|
||||
__attribute__((used))
|
||||
const int32_t SqliteConnection::regCreator_ = Connection::RegisterCreator(DB_SQLITE, SqliteConnection::Create);
|
||||
__attribute__((used))
|
||||
@ -1619,19 +1618,14 @@ bool SqliteConnection::IsDbVersionBelowSlave()
|
||||
|
||||
int SqliteConnection::CopyDb(const RdbStoreConfig &config, const std::string &srcPath, const std::string &destPath)
|
||||
{
|
||||
std::pair<int32_t, std::shared_ptr<Connection>> result = { E_ERROR, nullptr };
|
||||
auto &[ret, conn] = result;
|
||||
RdbStoreConfig srcConfig(config);
|
||||
srcConfig.SetPath(srcPath);
|
||||
srcConfig.SetIntegrityCheck(IntegrityCheck::FULL);
|
||||
srcConfig.SetHaMode(HAMode::SINGLE);
|
||||
for (uint32_t retry = 0; retry < ITERS_COUNT; ++retry) {
|
||||
auto [ret, conn] = Connection::Create(srcConfig, true);
|
||||
if (ret == E_SQLITE_CORRUPT && srcConfig.IsEncrypt() && srcConfig.GetIter() != ITER_V1) {
|
||||
srcConfig.SetIter(ITER_V1);
|
||||
std::tie(ret, conn) = Connection::Create(srcConfig, true);
|
||||
if (ret == E_SQLITE_CORRUPT && srcConfig.IsEncrypt()) {
|
||||
srcConfig.SetIter(ITER_V1);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ret != E_OK) {
|
||||
LOG_ERROR("backup file is corrupted, %{public}s", SqliteUtils::Anonymous(srcPath).c_str());
|
||||
|
Loading…
Reference in New Issue
Block a user