From f8bfc4fafa097f9bac622df95a187bdd6de6b23b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BB=96=E6=B0=B8=E7=85=8C?= Date: Tue, 29 Oct 2024 14:57:44 +0800 Subject: [PATCH] =?UTF-8?q?DFX=E5=A2=9E=E5=BC=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 廖永煌 --- .../relational/relational_sync_able_storage.h | 2 + .../include/icloud_sync_storage_interface.h | 2 + .../storage/include/storage_proxy.h | 2 + .../storage/src/cloud/cloud_storage_utils.cpp | 2 +- .../relational_sync_able_storage.cpp | 14 ++++++- .../sqlite_relational_database_upgrader.cpp | 6 +-- ...e_single_ver_relational_storage_executor.h | 2 + ...ver_relational_storage_executor_extend.cpp | 19 ++++++++++ .../src/sqlite/sqlite_cloud_kv_store.cpp | 29 ++++++++++++++- .../src/sqlite/sqlite_cloud_kv_store.h | 2 + .../storage/src/sqlite/sqlite_utils.h | 2 + .../src/sqlite/sqlite_utils_extend.cpp | 23 ++++++++++++ .../storage/src/storage_proxy.cpp | 10 +++++ .../syncer/src/cloud/cloud_syncer.cpp | 29 +++------------ .../syncer/src/cloud/cloud_syncer.h | 4 ++ .../syncer/src/cloud/cloud_syncer_extend.cpp | 37 ++++++++++++++++++- ...tributeddb_interfaces_nb_delegate_test.cpp | 2 + .../mock_icloud_sync_storage_interface.h | 1 + 18 files changed, 156 insertions(+), 32 deletions(-) diff --git a/frameworks/libs/distributeddb/interfaces/src/relational/relational_sync_able_storage.h b/frameworks/libs/distributeddb/interfaces/src/relational/relational_sync_able_storage.h index f05ecfb4ed5..7c2f5d3ade2 100644 --- a/frameworks/libs/distributeddb/interfaces/src/relational/relational_sync_able_storage.h +++ b/frameworks/libs/distributeddb/interfaces/src/relational/relational_sync_able_storage.h @@ -229,6 +229,8 @@ public: int GetCursor(const std::string &tableName, uint64_t &cursor) override; bool IsCurrentLogicDelete() const override; + + int GetLocalDataCount(const std::string &tableName, int &dataCount, int &logicDeleteDataCount) override; protected: int FillReferenceData(CloudSyncData &syncData); diff --git a/frameworks/libs/distributeddb/storage/include/icloud_sync_storage_interface.h b/frameworks/libs/distributeddb/storage/include/icloud_sync_storage_interface.h index c6d6e8e087e..b37840ec156 100644 --- a/frameworks/libs/distributeddb/storage/include/icloud_sync_storage_interface.h +++ b/frameworks/libs/distributeddb/storage/include/icloud_sync_storage_interface.h @@ -253,6 +253,8 @@ public: { return false; } + + virtual int GetLocalDataCount(const std::string &tableName, int &dataCount, int &logicDeleteDataCount) = 0; }; } diff --git a/frameworks/libs/distributeddb/storage/include/storage_proxy.h b/frameworks/libs/distributeddb/storage/include/storage_proxy.h index 95fce107a0a..64fd735dfb4 100644 --- a/frameworks/libs/distributeddb/storage/include/storage_proxy.h +++ b/frameworks/libs/distributeddb/storage/include/storage_proxy.h @@ -162,6 +162,8 @@ public: int ReviseLocalModTime(const std::string &tableName, const std::vector &revisedData); bool IsCurrentLogicDelete() const; + + int GetLocalDataCount(const std::string &tableName, int &dataCount, int &logicDeleteDataCount); protected: void Init(); diff --git a/frameworks/libs/distributeddb/storage/src/cloud/cloud_storage_utils.cpp b/frameworks/libs/distributeddb/storage/src/cloud/cloud_storage_utils.cpp index faea822a254..78e4dd4f4a4 100644 --- a/frameworks/libs/distributeddb/storage/src/cloud/cloud_storage_utils.cpp +++ b/frameworks/libs/distributeddb/storage/src/cloud/cloud_storage_utils.cpp @@ -1328,7 +1328,7 @@ int CloudStorageUtils::IdentifyCloudTypeInner(CloudSyncData &cloudSyncData, VBuc int CloudStorageUtils::CheckAbnormalData(CloudSyncData &cloudSyncData, const VBucket &data, bool isInsert) { if (data.empty()) { - LOGE("The cloud data is empty, isInsert:%d", isInsert); + LOGE("The cloud data is empty, isInsert:%d", static_cast(isInsert)); return -E_INVALID_DATA; } bool isDataAbnormal = false; diff --git a/frameworks/libs/distributeddb/storage/src/relational/relational_sync_able_storage.cpp b/frameworks/libs/distributeddb/storage/src/relational/relational_sync_able_storage.cpp index 415b514e4c5..2dce67203fc 100644 --- a/frameworks/libs/distributeddb/storage/src/relational/relational_sync_able_storage.cpp +++ b/frameworks/libs/distributeddb/storage/src/relational/relational_sync_able_storage.cpp @@ -2189,14 +2189,24 @@ int RelationalSyncAbleStorage::ReviseLocalModTime(const std::string &tableName, } int RelationalSyncAbleStorage::GetCursor(const std::string &tableName, uint64_t &cursor) +{ + if (transactionHandle_ == nullptr) { + LOGE("[RelationalSyncAbleStorage] the transaction has not been started"); + return -E_INVALID_DB; + } + return transactionHandle_->GetCursor(tableName, cursor); +} + +int RelationalSyncAbleStorage::GetLocalDataCount(const std::string &tableName, int &dataCount, + int &logicDeleteDataCount) { int errCode = E_OK; auto *handle = GetHandle(false, errCode); if (errCode != E_OK) { - LOGE("[RelationalSyncAbleStorage] Get handle failed when get cursor"); + LOGE("[RelationalSyncAbleStorage] Get handle failed when get local data count: %d", errCode); return errCode; } - errCode = handle->GetCursor(tableName, cursor); + errCode = handle->GetLocalDataCount(tableName, dataCount, logicDeleteDataCount); ReleaseHandle(handle); return errCode; } diff --git a/frameworks/libs/distributeddb/storage/src/sqlite/relational/sqlite_relational_database_upgrader.cpp b/frameworks/libs/distributeddb/storage/src/sqlite/relational/sqlite_relational_database_upgrader.cpp index 2d130f92525..4b3ab21722a 100644 --- a/frameworks/libs/distributeddb/storage/src/sqlite/relational/sqlite_relational_database_upgrader.cpp +++ b/frameworks/libs/distributeddb/storage/src/sqlite/relational/sqlite_relational_database_upgrader.cpp @@ -174,9 +174,9 @@ int SqliteRelationalDatabaseUpgrader::UpgradeCursor(const std::string &logTableV std::vector sqlVec; uint64_t cursor = DBConstant::INVALID_CURSOR; for (const auto &table : schemaObj.GetTables()) { - LOGI("[Relational][UpgradeCursor] cursor of table[%s length[%u]] before upgrade is [%lld]", - DBCommon::StringMiddleMasking(table.first).c_str(), table.first.length(), - SQLiteRelationalUtils::GetCursor(db_, table.first, cursor)); + SQLiteRelationalUtils::GetCursor(db_, table.first, cursor); + LOGI("[Relational][UpgradeCursor] cursor of table[%s length[%" PRIu32 "]] before upgrade is [%" PRIu64 "]", + DBCommon::StringMiddleMasking(table.first).c_str(), table.first.length(), cursor); sqlVec.push_back(CloudStorageUtils::GetCursorHeightenInLogSql(table.first)); sqlVec.push_back(CloudStorageUtils::GetCursorHeightenInMetaSql(table.first)); } diff --git a/frameworks/libs/distributeddb/storage/src/sqlite/relational/sqlite_single_ver_relational_storage_executor.h b/frameworks/libs/distributeddb/storage/src/sqlite/relational/sqlite_single_ver_relational_storage_executor.h index 52d35dcf241..5e03b5dd2ad 100644 --- a/frameworks/libs/distributeddb/storage/src/sqlite/relational/sqlite_single_ver_relational_storage_executor.h +++ b/frameworks/libs/distributeddb/storage/src/sqlite/relational/sqlite_single_ver_relational_storage_executor.h @@ -213,6 +213,8 @@ public: void SetTableSchema(const TableSchema &tableSchema); int ReviseLocalModTime(const std::string &tableName, const std::vector &revisedData); + + int GetLocalDataCount(const std::string &tableName, int &dataCount, int &logicDeleteDataCount); private: int DoCleanLogs(const std::vector &tableNameList, const RelationalSchemaObject &localSchema); diff --git a/frameworks/libs/distributeddb/storage/src/sqlite/relational/sqlite_single_ver_relational_storage_executor_extend.cpp b/frameworks/libs/distributeddb/storage/src/sqlite/relational/sqlite_single_ver_relational_storage_executor_extend.cpp index 4af16f048e9..ba6e5fd5e56 100644 --- a/frameworks/libs/distributeddb/storage/src/sqlite/relational/sqlite_single_ver_relational_storage_executor_extend.cpp +++ b/frameworks/libs/distributeddb/storage/src/sqlite/relational/sqlite_single_ver_relational_storage_executor_extend.cpp @@ -1571,5 +1571,24 @@ int SQLiteSingleVerRelationalStorageExecutor::GetAssetInfoOnTable(sqlite3_stmt * } return errCode; } + +int SQLiteSingleVerRelationalStorageExecutor::GetLocalDataCount(const std::string &tableName, int &dataCount, + int &logicDeleteDataCount) +{ + std::string dataCountSql = "select count(*) from " + DBCommon::GetLogTableName(tableName) + " where data_key != -1"; + int errCode = SQLiteUtils::GetCountBySql(dbHandle_, dataCountSql, dataCount); + if (errCode != E_OK) { + LOGE("[RDBExecutor] Query local data count failed: %d", errCode); + return errCode; + } + + std::string logicDeleteDataCountSql = "select count(*) from " + DBCommon::GetLogTableName(tableName) + + " where flag&0x08!=0 and data_key != -1"; + errCode = SQLiteUtils::GetCountBySql(dbHandle_, logicDeleteDataCountSql, logicDeleteDataCount); + if (errCode != E_OK) { + LOGE("[RDBExecutor] Query local logic delete data count failed: %d", errCode); + } + return errCode; +} } // namespace DistributedDB #endif diff --git a/frameworks/libs/distributeddb/storage/src/sqlite/sqlite_cloud_kv_store.cpp b/frameworks/libs/distributeddb/storage/src/sqlite/sqlite_cloud_kv_store.cpp index a74da1a479c..d0f9899f85a 100644 --- a/frameworks/libs/distributeddb/storage/src/sqlite/sqlite_cloud_kv_store.cpp +++ b/frameworks/libs/distributeddb/storage/src/sqlite/sqlite_cloud_kv_store.cpp @@ -693,4 +693,31 @@ int SqliteCloudKvStore::ReviseLocalModTime(const std::string &tableName, storageHandle_->RecycleStorageExecutor(handle); return errCode; } -} \ No newline at end of file + +int SqliteCloudKvStore::GetLocalDataCount(const std::string &tableName, int &dataCount, int &logicDeleteDataCount) +{ + auto [errCode, handle] = storageHandle_->GetStorageExecutor(true); + if (errCode != E_OK) { + LOGE("[SqliteCloudKvStore][GetLocalDataCount] Get handle failed: %d", errCode); + return errCode; + } + sqlite3 *db = nullptr; + (void)handle->GetDbHandle(db); + + std::string dataCountSql = "select count(*) from " + tableName; + errCode = SQLiteUtils::GetCountBySql(db, dataCountSql, dataCount); + if (errCode != E_OK) { + LOGE("[SqliteCloudKvStore][GetLocalDataCount] Query local data count failed: %d", errCode); + storageHandle_->RecycleStorageExecutor(handle); + return errCode; + } + + std::string logicDeleteDataCountSql = "select count(*) from " + tableName + " where flag&0x01 != 0"; + errCode = SQLiteUtils::GetCountBySql(db, logicDeleteDataCountSql, logicDeleteDataCount); + if (errCode != E_OK) { + LOGE("[SqliteCloudKvStore][GetLocalDataCount] Query local logic delete data count failed: %d", errCode); + } + storageHandle_->RecycleStorageExecutor(handle); + return errCode; +} +} diff --git a/frameworks/libs/distributeddb/storage/src/sqlite/sqlite_cloud_kv_store.h b/frameworks/libs/distributeddb/storage/src/sqlite/sqlite_cloud_kv_store.h index 9fcbe0e5ecf..d5533b9de15 100644 --- a/frameworks/libs/distributeddb/storage/src/sqlite/sqlite_cloud_kv_store.h +++ b/frameworks/libs/distributeddb/storage/src/sqlite/sqlite_cloud_kv_store.h @@ -106,6 +106,8 @@ public: int ReviseLocalModTime(const std::string &tableName, const std::vector &revisedData) override; + + int GetLocalDataCount(const std::string &tableName, int &dataCount, int &logicDeleteDataCount) override; private: std::pair GetTransactionDbHandleAndMemoryStatus(); diff --git a/frameworks/libs/distributeddb/storage/src/sqlite/sqlite_utils.h b/frameworks/libs/distributeddb/storage/src/sqlite/sqlite_utils.h index 99629c6fb7c..13b3b467756 100644 --- a/frameworks/libs/distributeddb/storage/src/sqlite/sqlite_utils.h +++ b/frameworks/libs/distributeddb/storage/src/sqlite/sqlite_utils.h @@ -202,6 +202,8 @@ public: static int AnalysisSchemaFieldDefine(sqlite3 *db, const std::string &tableName, TableInfo &table); static int StepNext(sqlite3_stmt *stmt, bool isMemDb = false); + + static int GetCountBySql(sqlite3 *db, const std::string &sql, int &count); private: static int CreateDataBase(const OpenDbProperties &properties, sqlite3 *&dbTemp, bool setWal); diff --git a/frameworks/libs/distributeddb/storage/src/sqlite/sqlite_utils_extend.cpp b/frameworks/libs/distributeddb/storage/src/sqlite/sqlite_utils_extend.cpp index 70af3573cb5..0b98cf2cfd4 100644 --- a/frameworks/libs/distributeddb/storage/src/sqlite/sqlite_utils_extend.cpp +++ b/frameworks/libs/distributeddb/storage/src/sqlite/sqlite_utils_extend.cpp @@ -695,4 +695,27 @@ int SQLiteUtils::StepNext(sqlite3_stmt *stmt, bool isMemDb) } return errCode; } + +int SQLiteUtils::GetCountBySql(sqlite3 *db, const std::string &sql, int &count) +{ + sqlite3_stmt *stmt = nullptr; + int errCode = SQLiteUtils::GetStatement(db, sql, stmt); + if (errCode != E_OK) { + LOGE("[SQLiteUtils][GetCountBySql] Get stmt failed when get local data count: %d", errCode); + return errCode; + } + errCode = SQLiteUtils::StepWithRetry(stmt, false); + if (errCode == SQLiteUtils::MapSQLiteErrno(SQLITE_ROW)) { + count = static_cast(sqlite3_column_int(stmt, 0)); + errCode = E_OK; + } else { + LOGE("[SQLiteUtils][GetCountBySql] Query local data count failed: %d", errCode); + } + int ret = E_OK; + SQLiteUtils::ResetStatement(stmt, true, ret); + if (ret != E_OK) { + LOGE("[SQLiteUtils][GetCountBySql] Reset stmt failed when get local data count: %d", ret); + } + return errCode != E_OK ? errCode : ret; +} } // namespace DistributedDB diff --git a/frameworks/libs/distributeddb/storage/src/storage_proxy.cpp b/frameworks/libs/distributeddb/storage/src/storage_proxy.cpp index 1d218e3cb4e..a06be3273ec 100644 --- a/frameworks/libs/distributeddb/storage/src/storage_proxy.cpp +++ b/frameworks/libs/distributeddb/storage/src/storage_proxy.cpp @@ -718,4 +718,14 @@ bool StorageProxy::IsCurrentLogicDelete() const } return store_->IsCurrentLogicDelete(); } + +int StorageProxy::GetLocalDataCount(const std::string &tableName, int &dataCount, int &logicDeleteDataCount) +{ + std::shared_lock readLock(storeMutex_); + if (store_ == nullptr) { + LOGE("[StorageProxy] no store found when get local data"); + return false; + } + return store_->GetLocalDataCount(tableName, dataCount, logicDeleteDataCount); +} } diff --git a/frameworks/libs/distributeddb/syncer/src/cloud/cloud_syncer.cpp b/frameworks/libs/distributeddb/syncer/src/cloud/cloud_syncer.cpp index 11369f28dee..52e2dd417a3 100644 --- a/frameworks/libs/distributeddb/syncer/src/cloud/cloud_syncer.cpp +++ b/frameworks/libs/distributeddb/syncer/src/cloud/cloud_syncer.cpp @@ -978,7 +978,7 @@ int CloudSyncer::SaveDataInTransaction(CloudSyncer::TaskId taskId, SyncParam &pa std::string maskStoreId = DBCommon::StringMiddleMasking(GetStoreIdByTask(taskId)); std::string maskTableName = DBCommon::StringMiddleMasking(param.info.tableName); if (storageProxy_->GetCursor(param.info.tableName, cursor) == E_OK) { - LOGI("[CloudSyncer] cursor before save data is %d, db: %s, table: %s, task id: %llu", cursor, + LOGI("[CloudSyncer] cursor before save data is %llu, db: %s, table: %s, task id: %llu", cursor, maskStoreId.c_str(), maskTableName.c_str(), taskId); } (void)storageProxy_->SetCursorIncFlag(true); @@ -990,7 +990,7 @@ int CloudSyncer::SaveDataInTransaction(CloudSyncer::TaskId taskId, SyncParam &pa ret = SaveData(taskId, param); (void)storageProxy_->SetCursorIncFlag(false); if (storageProxy_->GetCursor(param.info.tableName, cursor) == E_OK) { - LOGI("[CloudSyncer] cursor after save data is %d, db: %s, table: %s, task id: %llu", cursor, + LOGI("[CloudSyncer] cursor after save data is %llu, db: %s, table: %s, task id: %llu", cursor, maskStoreId.c_str(), maskTableName.c_str(), taskId); } param.insertPk.clear(); @@ -1504,8 +1504,9 @@ int CloudSyncer::PrepareSync(TaskId taskId) currentContext_.processRecorder = std::make_shared(); } LOGI("[CloudSyncer] exec storeId %.3s taskId %" PRIu64 " priority[%d] compensated[%d] logicDelete[%d]", - cloudTaskInfos_[taskId].storeId.c_str(), taskId, cloudTaskInfos_[taskId].priorityTask, - cloudTaskInfos_[taskId].compensatedTask, storageProxy_->IsCurrentLogicDelete()); + cloudTaskInfos_[taskId].storeId.c_str(), taskId, static_cast(cloudTaskInfos_[taskId].priorityTask), + static_cast(cloudTaskInfos_[taskId].compensatedTask), + static_cast(storageProxy_->IsCurrentLogicDelete())); return E_OK; } @@ -2045,26 +2046,6 @@ bool CloudSyncer::IsCurrentTableResume(TaskId taskId, bool upload) return upload == resumeTaskInfos_[taskId].upload; } -void CheckQueryCloudData(std::string &traceId, DownloadData &downloadData, std::vector &pkColNames) -{ - for (auto &data : downloadData.data) { - bool isVersionExist = data.count(CloudDbConstant::VERSION_FIELD) != 0; - bool isContainAllPk = true; - for (auto &pkColName : pkColNames) { - if (data.count(pkColName) == 0) { - isContainAllPk = false; - break; - } - } - std::string gid; - (void)CloudStorageUtils::GetValueFromVBucket(CloudDbConstant::GID_FIELD, data, gid); - if (!isVersionExist || !isContainAllPk) { - LOGE("[CloudSyncer] Invalid data from cloud, no version[%d], lost primary key[%d], gid[%s], traceId[%s]", - !isVersionExist, !isContainAllPk, gid.c_str(), traceId.c_str()); - } - } -} - int CloudSyncer::DownloadDataFromCloud(TaskId taskId, SyncParam ¶m, bool &abort, bool isFirstDownload) { diff --git a/frameworks/libs/distributeddb/syncer/src/cloud/cloud_syncer.h b/frameworks/libs/distributeddb/syncer/src/cloud/cloud_syncer.h index 37058f3807c..b6a2680a7f9 100644 --- a/frameworks/libs/distributeddb/syncer/src/cloud/cloud_syncer.h +++ b/frameworks/libs/distributeddb/syncer/src/cloud/cloud_syncer.h @@ -467,6 +467,10 @@ protected: static void AddNotifyDataFromDownloadAssets(const std::set &dupHashKeySet, DownloadItem &downloadItem, ChangedData &changedAssets); + void CheckDataAfterDownload(const std::string &tableName); + + void CheckQueryCloudData(std::string &traceId, DownloadData &downloadData, std::vector &pkColNames); + mutable std::mutex dataLock_; TaskId lastTaskId_; std::list taskQueue_; diff --git a/frameworks/libs/distributeddb/syncer/src/cloud/cloud_syncer_extend.cpp b/frameworks/libs/distributeddb/syncer/src/cloud/cloud_syncer_extend.cpp index fb9eeca3e38..31889d219a5 100644 --- a/frameworks/libs/distributeddb/syncer/src/cloud/cloud_syncer_extend.cpp +++ b/frameworks/libs/distributeddb/syncer/src/cloud/cloud_syncer_extend.cpp @@ -770,6 +770,7 @@ int CloudSyncer::DoDownloadInNeed(const CloudTaskInfo &taskInfo, const bool need if (errCode != E_OK) { return errCode; } + CheckDataAfterDownload(table); MarkDownloadFinishIfNeed(table); // needUpload indicate that the syncMode need push if (needUpload) { @@ -1486,4 +1487,38 @@ void CloudSyncer::AddNotifyDataFromDownloadAssets(const std::set &dupHashKe changedAssets.primaryData[ChangeType::OP_UPDATE].push_back(downloadItem.primaryKeyValList); } } -} \ No newline at end of file + +void CloudSyncer::CheckDataAfterDownload(const std::string &tableName) +{ + int dataCount = 0; + int logicDeleteDataCount = 0; + int errCode = storageProxy_->GetLocalDataCount(tableName, dataCount, logicDeleteDataCount); + if (errCode == E_OK) { + LOGI("[CloudSyncer] Check local data after download[%s[%u]], data count: %d, logic delete data count: %d", + DBCommon::StringMiddleMasking(tableName).c_str(), tableName.length(), dataCount, logicDeleteDataCount); + } else { + LOGW("[CloudSyncer] Get local data after download fail: %d", errCode); + } +} + +void CloudSyncer::CheckQueryCloudData(std::string &traceId, DownloadData &downloadData, + std::vector &pkColNames) +{ + for (auto &data : downloadData.data) { + bool isVersionExist = data.count(CloudDbConstant::VERSION_FIELD) != 0; + bool isContainAllPk = true; + for (auto &pkColName : pkColNames) { + if (data.count(pkColName) == 0) { + isContainAllPk = false; + break; + } + } + std::string gid; + (void)CloudStorageUtils::GetValueFromVBucket(CloudDbConstant::GID_FIELD, data, gid); + if (!isVersionExist || !isContainAllPk) { + LOGE("[CloudSyncer] Invalid data from cloud, no version[%d], lost primary key[%d], gid[%s], traceId[%s]", + static_cast(!isVersionExist), static_cast(!isContainAllPk), gid.c_str(), traceId.c_str()); + } + } +} +} diff --git a/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_nb_delegate_test.cpp b/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_nb_delegate_test.cpp index a95ec3c0b29..f9f6d09a923 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_nb_delegate_test.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_nb_delegate_test.cpp @@ -2280,6 +2280,8 @@ HWTEST_F(DistributedDBInterfacesNBDelegateTest, SingleVerGetSecurityOption001, T ASSERT_TRUE(g_kvNbDelegatePtr != nullptr); EXPECT_TRUE(g_kvDelegateStatus == OK); EXPECT_TRUE(g_kvNbDelegatePtr->GetSecurityOption(savedOption) == OK); + SecurityOption secOption = {option.secOption.securityLabel, option.secOption.securityFlag}; + EXPECT_TRUE(savedOption != secOption); EXPECT_TRUE(savedOption.securityLabel == 0); EXPECT_TRUE(savedOption.securityFlag == 0); diff --git a/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/mock_icloud_sync_storage_interface.h b/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/mock_icloud_sync_storage_interface.h index ec34ffe9f53..76e7912a7eb 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/mock_icloud_sync_storage_interface.h +++ b/frameworks/libs/distributeddb/test/unittest/common/syncer/cloud/mock_icloud_sync_storage_interface.h @@ -51,6 +51,7 @@ public: MOCK_METHOD1(CheckQueryValid, int(const QuerySyncObject &)); MOCK_METHOD1(IsSharedTable, bool(const std::string &)); MOCK_CONST_METHOD0(GetCloudSyncConfig, CloudSyncConfig()); + MOCK_METHOD3(GetLocalDataCount, int(const std::string &, int &, int &)); }; } -- Gitee