• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <condition_variable>
17 #include <gtest/gtest.h>
18 #include <gmock/gmock.h>
19 #include <thread>
20 
21 #include "db_constant.h"
22 #include "distributeddb_data_generate_unit_test.h"
23 #include "distributeddb_tools_unit_test.h"
24 #include "generic_single_ver_kv_entry.h"
25 #include "kv_store_nb_delegate.h"
26 #include "kv_virtual_device.h"
27 #include "mock_sync_task_context.h"
28 #include "platform_specific.h"
29 #include "relational_store_manager.h"
30 #include "runtime_config.h"
31 #include "single_ver_data_sync_utils.h"
32 
33 using namespace testing::ext;
34 using namespace DistributedDB;
35 using namespace DistributedDBUnitTest;
36 using namespace std;
37 
38 namespace {
39     std::shared_ptr<std::string> g_testDir = nullptr;
40     VirtualCommunicatorAggregator* g_communicatorAggregator = nullptr;
41     const std::string DEVICE_A = "real_device";
42     const std::string DEVICE_B = "deviceB";
43     const std::string DEVICE_C = "deviceC";
44     const std::string KEY_INSTANCE_ID = "INSTANCE_ID";
45     KvVirtualDevice *g_deviceB = nullptr;
46     KvVirtualDevice *g_deviceC = nullptr;
47     DistributedDBToolsUnitTest g_tool;
48 
OpenDelegate(const std::string & dlpPath,KvStoreNbDelegate * & delegatePtr,KvStoreDelegateManager & mgr,bool syncDualTupleMode=false)49     DBStatus OpenDelegate(const std::string &dlpPath, KvStoreNbDelegate *&delegatePtr,
50         KvStoreDelegateManager &mgr, bool syncDualTupleMode = false)
51     {
52         if (g_testDir == nullptr) {
53             return DB_ERROR;
54         }
55         std::string dbPath = *g_testDir + dlpPath;
56         KvStoreConfig storeConfig;
57         storeConfig.dataDir = dbPath;
58         OS::MakeDBDirectory(dbPath);
59         mgr.SetKvStoreConfig(storeConfig);
60 
61         string dir = dbPath + "/single_ver";
62         DIR* dirTmp = opendir(dir.c_str());
63         if (dirTmp == nullptr) {
64             OS::MakeDBDirectory(dir);
65         } else {
66             closedir(dirTmp);
67         }
68 
69         KvStoreNbDelegate::Option option;
70         option.syncDualTupleMode = syncDualTupleMode;
71         DBStatus res = OK;
72         mgr.GetKvStore(STORE_ID_1, option, [&delegatePtr, &res](DBStatus status, KvStoreNbDelegate *delegate) {
73             delegatePtr = delegate;
74             res = status;
75         });
76         return res;
77     }
78 
OpenDelegate(const std::string & dlpPath,RelationalStoreDelegate * & rdbDelegatePtr,RelationalStoreManager & mgr)79     DBStatus OpenDelegate(const std::string &dlpPath, RelationalStoreDelegate *&rdbDelegatePtr,
80         RelationalStoreManager &mgr)
81     {
82         if (g_testDir == nullptr) {
83             return DB_ERROR;
84         }
85         std::string dbDir = *g_testDir + dlpPath;
86         OS::MakeDBDirectory(dbDir);
87         std::string dbPath = dbDir + "/test.db";
88         auto db = RelationalTestUtils::CreateDataBase(dbPath);
89         EXPECT_EQ(sqlite3_exec(db, "PRAGMA journal_mode=WAL;", nullptr, nullptr, nullptr), SQLITE_OK);
90         EXPECT_EQ(sqlite3_close_v2(db), SQLITE_OK);
91         db = nullptr;
92         RelationalStoreDelegate::Option option;
93         return mgr.OpenStore(dbPath, STORE_ID_1, option, rdbDelegatePtr);
94     }
95 
CloseDelegate(KvStoreNbDelegate * & delegatePtr,KvStoreDelegateManager & mgr,std::string storeID)96     void CloseDelegate(KvStoreNbDelegate *&delegatePtr, KvStoreDelegateManager &mgr, std::string storeID)
97     {
98         if (delegatePtr == nullptr) {
99             return;
100         }
101         EXPECT_EQ(mgr.CloseKvStore(delegatePtr), OK);
102         delegatePtr = nullptr;
103         EXPECT_EQ(mgr.DeleteKvStore(storeID), OK);
104     }
105 
CloseDelegate(RelationalStoreDelegate * & delegatePtr,RelationalStoreManager & mgr)106     void CloseDelegate(RelationalStoreDelegate *&delegatePtr, RelationalStoreManager &mgr)
107     {
108         if (delegatePtr == nullptr) {
109             return;
110         }
111         EXPECT_EQ(mgr.CloseStore(delegatePtr), OK);
112         delegatePtr = nullptr;
113     }
114 }
115 
116 class MockVirtualSingleVerSyncDBInterface : public VirtualSingleVerSyncDBInterface {
117 public:
118     MOCK_CONST_METHOD1(GetSecurityOption, int(SecurityOption &));
119 };
120 
121 class DistributedDBSingleVerDLPTest : public testing::Test {
122 public:
123     MockVirtualSingleVerSyncDBInterface *syncInterfaceC = nullptr;
124 public:
125     static void SetUpTestCase(void);
126     static void TearDownTestCase(void);
127     void SetUp();
128     void TearDown();
129 };
130 
SetUpTestCase(void)131 void DistributedDBSingleVerDLPTest::SetUpTestCase(void)
132 {
133     /**
134      * @tc.setup: Init datadir and Virtual Communicator.
135      */
136     std::string testDir;
137     DistributedDBToolsUnitTest::TestDirInit(testDir);
138     if (g_testDir == nullptr) {
139         g_testDir = std::make_shared<std::string>(testDir);
140     }
141 
142     g_communicatorAggregator = new (std::nothrow) VirtualCommunicatorAggregator();
143     ASSERT_TRUE(g_communicatorAggregator != nullptr);
144     RuntimeContext::GetInstance()->SetCommunicatorAggregator(g_communicatorAggregator);
145 }
146 
TearDownTestCase(void)147 void DistributedDBSingleVerDLPTest::TearDownTestCase(void)
148 {
149     /**
150      * @tc.teardown: Release virtual Communicator and clear data dir.
151      */
152     if (g_testDir != nullptr && DistributedDBToolsUnitTest::RemoveTestDbFiles(*g_testDir) != 0) {
153         LOGE("rm test db files error!");
154     }
155     RuntimeContext::GetInstance()->SetCommunicatorAggregator(nullptr);
156 }
157 
SetUp(void)158 void DistributedDBSingleVerDLPTest::SetUp(void)
159 {
160     DistributedDBToolsUnitTest::PrintTestCaseInfo();
161     g_deviceB = new (std::nothrow) KvVirtualDevice(DEVICE_B);
162     ASSERT_TRUE(g_deviceB != nullptr);
163     g_deviceC = new (std::nothrow) KvVirtualDevice(DEVICE_C);
164     ASSERT_TRUE(g_deviceC != nullptr);
165     VirtualSingleVerSyncDBInterface *syncInterfaceB = new (std::nothrow) VirtualSingleVerSyncDBInterface();
166     ASSERT_TRUE(syncInterfaceB != nullptr);
167     ASSERT_EQ(g_deviceB->Initialize(g_communicatorAggregator, syncInterfaceB), E_OK);
168     syncInterfaceC = new (std::nothrow) MockVirtualSingleVerSyncDBInterface();
169     ASSERT_TRUE(syncInterfaceC != nullptr);
170     ASSERT_EQ(g_deviceC->Initialize(g_communicatorAggregator, syncInterfaceC), E_OK);
171 }
172 
TearDown(void)173 void DistributedDBSingleVerDLPTest::TearDown(void)
174 {
175     if (g_deviceB != nullptr) {
176         delete g_deviceB;
177         g_deviceB = nullptr;
178     }
179     if (g_deviceC != nullptr) {
180         delete g_deviceC;
181         g_deviceC = nullptr;
182     }
183     PermissionCheckCallbackV3 nullCallback = nullptr;
184     RuntimeConfig::SetPermissionCheckCallback(nullCallback);
185     SyncActivationCheckCallbackV2 activeCallBack = nullptr;
186     RuntimeConfig::SetSyncActivationCheckCallback(activeCallBack);
187     RuntimeConfig::SetPermissionConditionCallback(nullptr);
188 }
189 
190 /**
191  * @tc.name: SameDelegateTest001
192  * @tc.desc: Test kv delegate open with diff instanceID.
193  * @tc.type: FUNC
194  * @tc.require:
195  * @tc.author: zhangqiquan
196  */
197 HWTEST_F(DistributedDBSingleVerDLPTest, SameDelegateTest001, TestSize.Level1)
198 {
199     KvStoreDelegateManager mgr1(APP_ID, USER_ID, INSTANCE_ID_1);
200     KvStoreNbDelegate *delegatePtr1 = nullptr;
201     EXPECT_EQ(OpenDelegate("/dlp1", delegatePtr1, mgr1), OK);
202     ASSERT_NE(delegatePtr1, nullptr);
203 
204     KvStoreDelegateManager mgr2(APP_ID, USER_ID, INSTANCE_ID_2);
205     KvStoreNbDelegate *delegatePtr2 = nullptr;
206     EXPECT_EQ(OpenDelegate("/dlp2", delegatePtr2, mgr2), OK);
207     ASSERT_NE(delegatePtr2, nullptr);
208 
209     Key key1 = {'k', '1'};
210     Value value1 = {'v', '1'};
211     delegatePtr1->Put(key1, value1);
212     Key key2 = {'k', '2'};
213     Value value2 = {'v', '2'};
214     delegatePtr2->Put(key2, value2);
215 
216     Value value;
217     EXPECT_EQ(delegatePtr1->Get(key1, value), OK);
218     EXPECT_EQ(value1, value);
219     EXPECT_EQ(delegatePtr2->Get(key2, value), OK);
220     EXPECT_EQ(value2, value);
221 
222     EXPECT_EQ(delegatePtr1->Get(key2, value), NOT_FOUND);
223     EXPECT_EQ(delegatePtr2->Get(key1, value), NOT_FOUND);
224 
225     CloseDelegate(delegatePtr1, mgr1, STORE_ID_1);
226     CloseDelegate(delegatePtr2, mgr2, STORE_ID_1);
227 }
228 
229 /**
230  * @tc.name: SameDelegateTest002
231  * @tc.desc: Test rdb delegate open with diff instanceID.
232  * @tc.type: FUNC
233  * @tc.require:
234  * @tc.author: zhangqiquan
235  */
236 HWTEST_F(DistributedDBSingleVerDLPTest, SameDelegateTest002, TestSize.Level1)
237 {
238     RelationalStoreManager mgr1(APP_ID, USER_ID, INSTANCE_ID_1);
239     RelationalStoreDelegate *rdbDelegatePtr1 = nullptr;
240     EXPECT_EQ(OpenDelegate("/dlp1", rdbDelegatePtr1, mgr1), OK);
241     ASSERT_NE(rdbDelegatePtr1, nullptr);
242 
243     RelationalStoreManager mgr2(APP_ID, USER_ID, INSTANCE_ID_2);
244     RelationalStoreDelegate *rdbDelegatePtr2 = nullptr;
245     EXPECT_EQ(OpenDelegate("/dlp2", rdbDelegatePtr2, mgr2), OK);
246     ASSERT_NE(rdbDelegatePtr2, nullptr);
247 
248     CloseDelegate(rdbDelegatePtr1, mgr1);
249     CloseDelegate(rdbDelegatePtr2, mgr2);
250 }
251 
252 /**
253  * @tc.name: DlpDelegateCRUDTest001
254  * @tc.desc: Test dlp delegate crud function.
255  * @tc.type: FUNC
256  * @tc.require:
257  * @tc.author: zhangqiquan
258  */
259 HWTEST_F(DistributedDBSingleVerDLPTest, DlpDelegateCRUDTest001, TestSize.Level1)
260 {
261     KvStoreDelegateManager mgr1(APP_ID, USER_ID, INSTANCE_ID_1);
262     KvStoreNbDelegate *delegatePtr1 = nullptr;
263     EXPECT_EQ(OpenDelegate("/dlp1", delegatePtr1, mgr1), OK);
264     ASSERT_NE(delegatePtr1, nullptr);
265 
266     Key key1 = {'k', '1'};
267     Value value1 = {'v', '1'};
268     delegatePtr1->Put(key1, value1);
269 
270     Value value;
271     EXPECT_EQ(delegatePtr1->Get(key1, value), OK);
272     EXPECT_EQ(value1, value);
273 
274     Value value2 = {'v', '2'};
275     delegatePtr1->Put(key1, value2);
276     EXPECT_EQ(delegatePtr1->Get(key1, value), OK);
277     EXPECT_EQ(value2, value);
278 
279     EXPECT_EQ(delegatePtr1->Delete(key1), OK);
280     EXPECT_EQ(delegatePtr1->Get(key1, value), NOT_FOUND);
281 
282     CloseDelegate(delegatePtr1, mgr1, STORE_ID_1);
283 }
284 
285 /**
286  * @tc.name: SandboxDelegateSync001
287  * @tc.desc: Test dlp delegate sync function.
288  * @tc.type: FUNC
289  * @tc.require:
290  * @tc.author: zhangqiquan
291  */
292 HWTEST_F(DistributedDBSingleVerDLPTest, SandboxDelegateSync001, TestSize.Level1)
293 {
294     KvStoreDelegateManager mgr1(APP_ID, USER_ID, INSTANCE_ID_1);
__anonbaa6dcfe0302(const PermissionCheckParam &param, uint8_t flag) 295     RuntimeConfig::SetPermissionCheckCallback([](const PermissionCheckParam &param, uint8_t flag) {
296         if ((flag & PermissionCheckFlag::CHECK_FLAG_RECEIVE) != 0) {
297             bool res = false;
298             if (param.extraConditions.find(KEY_INSTANCE_ID) != param.extraConditions.end()) {
299                 res = param.extraConditions.at(KEY_INSTANCE_ID) == std::to_string(INSTANCE_ID_1);
300             }
301             return res;
302         }
303         if (param.userId != USER_ID || param.appId != APP_ID || param.storeId != STORE_ID_1 ||
304             (param.instanceId != INSTANCE_ID_1 && param.instanceId != 0)) {
305             return false;
306         }
307         return true;
308     });
__anonbaa6dcfe0402(const PermissionConditionParam &param) 309     RuntimeConfig::SetPermissionConditionCallback([](const PermissionConditionParam &param) {
310         std::map<std::string, std::string> res;
311         res.emplace(KEY_INSTANCE_ID, std::to_string(INSTANCE_ID_1));
312         return res;
313     });
314 
315     KvStoreNbDelegate *delegatePtr1 = nullptr;
316     EXPECT_EQ(OpenDelegate("/dlp1", delegatePtr1, mgr1), OK);
317     ASSERT_NE(delegatePtr1, nullptr);
318 
319     Key key1 = {'k', '1'};
320     Value value1 = {'v', '1'};
321     delegatePtr1->Put(key1, value1);
322 
323     std::map<std::string, DBStatus> result;
324     DBStatus status = g_tool.SyncTest(delegatePtr1, { DEVICE_B }, SYNC_MODE_PUSH_ONLY, result);
325     EXPECT_TRUE(status == OK);
326     EXPECT_EQ(result[DEVICE_B], OK);
327 
328     CloseDelegate(delegatePtr1, mgr1, STORE_ID_1);
329 }
330 
331 /**
332  * @tc.name: SandboxDelegateSync002
333  * @tc.desc: Test dlp delegate sync active if callback return true.
334  * @tc.type: FUNC
335  * @tc.require:
336  * @tc.author: zhangqiquan
337  */
338 HWTEST_F(DistributedDBSingleVerDLPTest, SandboxDelegateSync002, TestSize.Level1)
339 {
340     KvStoreDelegateManager mgr1(APP_ID, USER_ID, INSTANCE_ID_1);
__anonbaa6dcfe0502(const ActivationCheckParam &param) 341     RuntimeConfig::SetSyncActivationCheckCallback([](const ActivationCheckParam &param) {
342         if (param.userId == USER_ID && param.appId == APP_ID && param.storeId == STORE_ID_1 &&
343             param.instanceId == INSTANCE_ID_1) {
344             return true;
345         }
346         return false;
347     });
348 
349     KvStoreNbDelegate *delegatePtr1 = nullptr;
350     EXPECT_EQ(OpenDelegate("/dlp1", delegatePtr1, mgr1, true), OK);
351     ASSERT_NE(delegatePtr1, nullptr);
352 
353     std::map<std::string, DBStatus> result;
354     DBStatus status = g_tool.SyncTest(delegatePtr1, { DEVICE_B }, SYNC_MODE_PUSH_ONLY, result);
355     EXPECT_EQ(status, OK);
356     EXPECT_EQ(result[DEVICE_B], OK);
357 
358     CloseDelegate(delegatePtr1, mgr1, STORE_ID_1);
359 }
360 
361 /**
362  * @tc.name: SingleVerUtilsTest001
363  * @tc.desc: Test single verification utils function.
364  * @tc.type: FUNC
365  * @tc.require:
366  * @tc.author: lg
367  */
368 HWTEST_F(DistributedDBSingleVerDLPTest, SingleVerUtilsTest001, TestSize.Level0)
369 {
370     bool isCheckStatus;
371     EXPECT_EQ(SingleVerDataSyncUtils::QuerySyncCheck(nullptr, isCheckStatus), -E_INVALID_ARGS);
372     MockSyncTaskContext context;
373     context.SetQuerySync(true);
374     context.SetRemoteSoftwareVersion(SOFTWARE_VERSION_RELEASE_1_0);
375     EXPECT_EQ(SingleVerDataSyncUtils::QuerySyncCheck(&context, isCheckStatus), OK);
376     context.SetRemoteSoftwareVersion(SOFTWARE_VERSION_RELEASE_3_0);
377     EXPECT_EQ(SingleVerDataSyncUtils::QuerySyncCheck(&context, isCheckStatus), OK);
378     EXPECT_EQ(SingleVerDataSyncUtils::RequestQueryCheck(nullptr, nullptr), -E_INVALID_ARGS);
379 
380     std::string deviceId;
381     SecurityOption option;
382     EXPECT_EQ(SingleVerDataSyncUtils::IsPermitRemoteDeviceRecvData(deviceId, option, nullptr), false);
383     EXPECT_CALL(*syncInterfaceC, GetSecurityOption(testing::_)).WillOnce(testing::Return(-E_INVALID_DB));
384     EXPECT_EQ(SingleVerDataSyncUtils::IsPermitRemoteDeviceRecvData(deviceId, option, syncInterfaceC), false);
385     EXPECT_CALL(*syncInterfaceC, GetSecurityOption(testing::_)).WillRepeatedly(testing::Return(E_OK));
386     EXPECT_EQ(SingleVerDataSyncUtils::IsPermitRemoteDeviceRecvData(deviceId, option, syncInterfaceC), false);
387     std::vector<SendDataItem> outData = {nullptr};
388     SingleVerDataSyncUtils::TransDbDataItemToSendDataItem(deviceId, outData);
389     SingleVerDataSyncUtils::TransSendDataItemToLocal(&context, deviceId, outData);
390     int errNo = E_OK;
391     auto communicator = g_communicatorAggregator->AllocCommunicator(12345, errNo);
392     EXPECT_EQ(SingleVerDataSyncUtils::CheckPermitReceiveData(&context, communicator, syncInterfaceC), false);
393     EXPECT_CALL(*syncInterfaceC, GetSecurityOption(testing::_)).WillRepeatedly(testing::Return(-E_NOT_SUPPORT));
394     EXPECT_EQ(SingleVerDataSyncUtils::CheckPermitReceiveData(&context, communicator, syncInterfaceC), true);
395     option.securityLabel = SecurityLabel::S0;
396     context.SetRemoteSeccurityOption(option);
397     EXPECT_CALL(*syncInterfaceC, GetSecurityOption(testing::_))
__anonbaa6dcfe0602(SecurityOption &option) 398         .WillRepeatedly(testing::Invoke([](SecurityOption &option) {
399             option.securityLabel = SecurityLabel::S1;
400             return E_OK;
401         }));
402     EXPECT_EQ(SingleVerDataSyncUtils::CheckPermitReceiveData(&context, communicator, syncInterfaceC), true);
403     EXPECT_CALL(*syncInterfaceC, GetSecurityOption(testing::_))
__anonbaa6dcfe0702(SecurityOption &option) 404         .WillRepeatedly(testing::Invoke([](SecurityOption &option) {
405             option.securityLabel = SecurityLabel::S1;
406             return E_OK;
407         }));
408     option.securityLabel = FAILED_GET_SEC_CLASSIFICATION;
409     context.SetRemoteSeccurityOption(option);
410     EXPECT_EQ(SingleVerDataSyncUtils::CheckPermitReceiveData(&context, communicator, syncInterfaceC), false);
411     EXPECT_CALL(*syncInterfaceC, GetSecurityOption(testing::_)).Times(testing::AtLeast(0));
412     g_communicatorAggregator->ReleaseCommunicator(communicator);
413 }
414 
415 /**
416  * @tc.name: SingleVerUtilsTest002
417  * @tc.desc: Test single verification utils function.
418  * @tc.type: FUNC
419  * @tc.require:
420  * @tc.author: lg
421  */
422 HWTEST_F(DistributedDBSingleVerDLPTest, SingleVerUtilsTest002, TestSize.Level0)
423 {
424     MockSyncTaskContext context;
425     context.SetRemoteSoftwareVersion(SOFTWARE_VERSION_RELEASE_3_0);
426     context.SetTaskErrCode(-E_EKEYREVOKED);
427     context.SetMode(SyncModeType::PUSH_AND_PULL);
428     SingleVerDataSyncUtils::PushAndPullKeyRevokHandle(&context);
429     EXPECT_EQ(SingleVerDataSyncUtils::GetReSendMode(SyncModeType::RESPONSE_PULL, 1, SyncType::QUERY_SYNC_TYPE),
430         SyncModeType::QUERY_PUSH);
431     EXPECT_EQ(SingleVerDataSyncUtils::GetReSendMode(SyncModeType::QUERY_PUSH_PULL, 1, SyncType::QUERY_SYNC_TYPE),
432         SyncModeType::QUERY_PUSH_PULL);
433     EXPECT_EQ(SingleVerDataSyncUtils::GetReSendMode(SyncModeType::QUERY_PUSH_PULL, 0, SyncType::QUERY_SYNC_TYPE),
434         SyncModeType::QUERY_PUSH);
435     EXPECT_EQ(
436         SingleVerDataSyncUtils::GetControlCmdType(SyncModeType::QUERY_PUSH_PULL), ControlCmdType::INVALID_CONTROL_CMD);
437     EXPECT_EQ(SingleVerDataSyncUtils::GetModeByControlCmdType(ControlCmdType::INVALID_CONTROL_CMD),
438         SyncModeType::INVALID_MODE);
439     EXPECT_EQ(SingleVerDataSyncUtils::GetModeByControlCmdType(ControlCmdType::UNSUBSCRIBE_QUERY_CMD),
440         SyncModeType::UNSUBSCRIBE_QUERY);
441     QuerySyncObject query;
442     EXPECT_EQ(SingleVerDataSyncUtils::IsNeedTriggerQueryAutoSync(nullptr, query), false);
443     Message msg;
444     msg.SetMessageId(CONTROL_SYNC_MESSAGE);
445     msg.SetMessageType(TYPE_REQUEST);
446     EXPECT_EQ(SingleVerDataSyncUtils::IsNeedTriggerQueryAutoSync(&msg, query), false);
447     std::vector<SendDataItem> inData = {nullptr};
448     SingleVerDataSyncUtils::GetMaxSendDataTime(inData);
449     UpdateWaterMark isUpdate;
450     auto kvEnv = new (std::nothrow) GenericSingleVerKvEntry();
451     inData.push_back(kvEnv);
452     SingleVerDataSyncUtils::GetFullSyncDataTimeRange(inData, 100, isUpdate);
453     SingleVerDataSyncUtils::GetQuerySyncDataTimeRange(inData, 100, 100, isUpdate);
454     DataItem dataItem;
455     dataItem.flag = DataItem::DELETE_FLAG;
456     kvEnv->SetEntryData(std::move(dataItem));
457     SingleVerDataSyncUtils::GetQuerySyncDataTimeRange(inData, 100, 100, isUpdate);
458     delete kvEnv;
459 }