diff --git a/frameworks/libs/distributeddb/storage/src/sqlite/relational/sqlite_single_relational_storage_engine.cpp b/frameworks/libs/distributeddb/storage/src/sqlite/relational/sqlite_single_relational_storage_engine.cpp index a847dc50346871e0656bc8a272e106e542fe10eb..64a7cc8464d1cfda77771bae87c88d284becde9a 100644 --- a/frameworks/libs/distributeddb/storage/src/sqlite/relational/sqlite_single_relational_storage_engine.cpp +++ b/frameworks/libs/distributeddb/storage/src/sqlite/relational/sqlite_single_relational_storage_engine.cpp @@ -316,6 +316,7 @@ int SQLiteSingleRelationalStorageEngine::CreateDistributedTable(const CreateDist } if (param.isAsync && !table.GetTrackerTable().GetTableName().empty()) { LOGE("[CreateDistributedTable] not support async create distributed table on tracker table"); + (void)handle->Rollback(); return -E_NOT_SUPPORT; } if (!table.GetTrackerTable().IsEmpty() && param.syncType == TableSyncType::DEVICE_COOPERATION && diff --git a/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_stop_task_test.cpp b/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_stop_task_test.cpp index 6868a9bca403926bda848f360ca3f28f937ba28d..b932c98de66e36634e2dc6573a396514c4aeee8d 100644 --- a/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_stop_task_test.cpp +++ b/frameworks/libs/distributeddb/test/unittest/common/interfaces/distributeddb_interfaces_stop_task_test.cpp @@ -1014,6 +1014,11 @@ HWTEST_F(DistributedDBInterfacesStopTaskTest, AsyncCreateDistributedDBTableTest0 bool isExistFlag = true; CheckAsyncGenLogFlag(NORMAL_TABLE, isExistFlag); EXPECT_FALSE(isExistFlag); + /** + * @tc.steps:step3. Async create distributed table again. + * @tc.expected: step3. Return NOT_SUPPORT. + */ + EXPECT_EQ(g_delegate->CreateDistributedTable(NORMAL_TABLE, CLOUD_COOPERATION, {true}), NOT_SUPPORT); } /**