!1352 【分布式DB】处理告警问题

Merge pull request !1352 from holding/master
This commit is contained in:
openharmony_ci 2024-10-19 03:44:54 +00:00 committed by Gitee
commit 0bdb1d1209
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 5 additions and 5 deletions

View File

@ -151,7 +151,7 @@ public:
static std::string GetCursorKey(const std::string &tableName);
static bool ConvertToInt(const std::string &str, int &value);
static bool ConvertToUInt(const std::string &str, uint64_t &value);
static void RemoveDuplicateAssetsData(std::vector<Asset> &assets);
private:

View File

@ -803,7 +803,7 @@ std::string DBCommon::GetCursorKey(const std::string &tableName)
return DBConstant::RELATIONAL_PREFIX + "cursor_" + ToLowerCase(tableName);
}
bool DBCommon::ConvertToInt(const std::string &str, int &value)
bool DBCommon::ConvertToUInt(const std::string &str, uint64_t &value)
{
auto [ptr, errCode] = std::from_chars(str.data(), str.data() + str.size(), value);
return errCode == std::errc{} && ptr == str.data() + str.size();
@ -833,9 +833,9 @@ void DBCommon::RemoveDuplicateAssetsData(std::vector<Asset> &assets)
indexMap[asset.name] = prevIndex;
continue;
}
int modifyTime = 0;
int prevModifyTime = 0;
if (ConvertToInt(asset.modifyTime, modifyTime) && ConvertToInt(prevAsset.modifyTime, prevModifyTime) &&
uint64_t modifyTime = 0;
uint64_t prevModifyTime = 0;
if (ConvertToUInt(asset.modifyTime, modifyTime) && ConvertToUInt(prevAsset.modifyTime, prevModifyTime) &&
!asset.modifyTime.empty() && !prevAsset.modifyTime.empty()) {
arr[modifyTime > prevModifyTime ? prevIndex : i] = 1;
indexMap[asset.name] = modifyTime > prevModifyTime ? i : prevIndex;