diff options
| author | dcherednik <[email protected]> | 2022-07-21 10:11:23 +0300 |
|---|---|---|
| committer | dcherednik <[email protected]> | 2022-07-21 10:11:23 +0300 |
| commit | 341f0f2ef841c5277ec8520325d8f15521442cd0 (patch) | |
| tree | a14d60b832ff87f126ce369325e84defce581821 | |
| parent | 7c3c2d7fb03a1591e94b4c02416793e6d7576a88 (diff) | |
Ut to check write to async index.
| -rw-r--r-- | ydb/core/kqp/ut/kqp_indexes_multishard_ut.cpp | 30 | ||||
| -rw-r--r-- | ydb/core/testlib/test_client.cpp | 4 | ||||
| -rw-r--r-- | ydb/core/testlib/test_client.h | 3 |
3 files changed, 25 insertions, 12 deletions
diff --git a/ydb/core/kqp/ut/kqp_indexes_multishard_ut.cpp b/ydb/core/kqp/ut/kqp_indexes_multishard_ut.cpp index aba32bdb25e..b5f5cc85a31 100644 --- a/ydb/core/kqp/ut/kqp_indexes_multishard_ut.cpp +++ b/ydb/core/kqp/ut/kqp_indexes_multishard_ut.cpp @@ -29,7 +29,7 @@ NYdb::NTable::TDataQueryResult ExecuteDataQuery(TSession& session, const TString TExecDataQuerySettings().KeepInQueryCache(true)).ExtractValueSync(); } -void CreateTableWithMultishardIndex(Tests::TClient& client) { +void CreateTableWithMultishardIndex(Tests::TClient& client, bool async) { const TString scheme = R"(Name: "MultiShardIndexed" Columns { Name: "key" Type: "Uint64" } Columns { Name: "fk" Type: "Uint32" } @@ -42,8 +42,11 @@ void CreateTableWithMultishardIndex(Tests::TClient& client) { NKikimrSchemeOp::TTableDescription desc; bool parseOk = ::google::protobuf::TextFormat::ParseFromString(scheme, &desc); UNIT_ASSERT(parseOk); + NKikimrSchemeOp::EIndexType type = async + ? NKikimrSchemeOp::EIndexType::EIndexTypeGlobalAsync + : NKikimrSchemeOp::EIndexType::EIndexTypeGlobal; - auto status = client.TClient::CreateTableWithUniformShardedIndex("/Root", desc, "index", {"fk"}); + auto status = client.TClient::CreateTableWithUniformShardedIndex("/Root", desc, "index", {"fk"}, type); UNIT_ASSERT_VALUES_EQUAL(status, NMsgBusProxy::MSTATUS_OK); } @@ -62,7 +65,7 @@ void CreateTableWithMultishardIndexAndDataColumn(Tests::TClient& client) { bool parseOk = ::google::protobuf::TextFormat::ParseFromString(scheme, &desc); UNIT_ASSERT(parseOk); - auto status = client.TClient::CreateTableWithUniformShardedIndex("/Root", desc, "index", {"fk"}, {"value"}); + auto status = client.TClient::CreateTableWithUniformShardedIndex("/Root", desc, "index", {"fk"}, NKikimrSchemeOp::EIndexType::EIndexTypeGlobal, {"value"}); UNIT_ASSERT_VALUES_EQUAL(status, NMsgBusProxy::MSTATUS_OK); } @@ -128,7 +131,7 @@ void FillTable(NYdb::NTable::TSession& session) { Y_UNIT_TEST_SUITE(KqpMultishardIndex) { Y_UNIT_TEST_NEW_ENGINE(SortedRangeReadDesc) { TKikimrRunner kikimr(SyntaxV1Settings()); - CreateTableWithMultishardIndex(kikimr.GetTestClient()); + CreateTableWithMultishardIndex(kikimr.GetTestClient(), false); auto db = kikimr.GetTableClient(); auto session = db.CreateSession().GetValueSync().GetSession(); FillTable<UseNewEngine>(session); @@ -146,7 +149,7 @@ Y_UNIT_TEST_SUITE(KqpMultishardIndex) { Y_UNIT_TEST_NEW_ENGINE(SecondaryIndexSelect) { TKikimrRunner kikimr(SyntaxV1Settings()); - CreateTableWithMultishardIndex(kikimr.GetTestClient()); + CreateTableWithMultishardIndex(kikimr.GetTestClient(), false); auto db = kikimr.GetTableClient(); auto session = db.CreateSession().GetValueSync().GetSession(); FillTable<UseNewEngine>(session); @@ -299,7 +302,7 @@ Y_UNIT_TEST_SUITE(KqpMultishardIndex) { Y_UNIT_TEST(YqWorksFineAfterAlterIndexTableDirectly) { TKikimrRunner kikimr(SyntaxV1Settings()); - CreateTableWithMultishardIndex(kikimr.GetTestClient()); + CreateTableWithMultishardIndex(kikimr.GetTestClient(), false); auto db = kikimr.GetTableClient(); auto session = db.CreateSession().GetValueSync().GetSession(); @@ -1047,7 +1050,7 @@ Y_UNIT_TEST_SUITE(KqpMultishardIndex) { auto db = kikimr.GetTableClient(); auto session = db.CreateSession().GetValueSync().GetSession(); - CreateTableWithMultishardIndex(kikimr.GetTestClient()); + CreateTableWithMultishardIndex(kikimr.GetTestClient(), false); FillTable<UseNewEngine>(session); AssertSuccessResult(session.ExecuteDataQuery(Q1_(R"( @@ -1098,12 +1101,13 @@ Y_UNIT_TEST_SUITE(KqpMultishardIndex) { ])", FormatResultSetYson(result.GetResultSet(0))); } - Y_UNIT_TEST_NEW_ENGINE(WriteIntoRenamingIndex) { + template<bool UseNewEngine> + void CheckWriteIntoRenamingIndex(bool asyncIndex) { TKikimrRunner kikimr; auto db = kikimr.GetTableClient(); auto session = db.CreateSession().GetValueSync().GetSession(); - CreateTableWithMultishardIndex(kikimr.GetTestClient()); + CreateTableWithMultishardIndex(kikimr.GetTestClient(), asyncIndex); auto buildParam = [&db](ui64 id) { return db.GetParamsBuilder() @@ -1215,6 +1219,14 @@ Y_UNIT_TEST_SUITE(KqpMultishardIndex) { UNIT_ASSERT_VALUES_EQUAL(rowsInserted, rowsRead); } } + + Y_UNIT_TEST_NEW_ENGINE(WriteIntoRenamingSyncIndex) { + CheckWriteIntoRenamingIndex<UseNewEngine>(false); + } + + Y_UNIT_TEST_NEW_ENGINE(WriteIntoRenamingAsyncIndex) { + CheckWriteIntoRenamingIndex<UseNewEngine>(true); + } } } diff --git a/ydb/core/testlib/test_client.cpp b/ydb/core/testlib/test_client.cpp index d1319f60597..68575bb8130 100644 --- a/ydb/core/testlib/test_client.cpp +++ b/ydb/core/testlib/test_client.cpp @@ -1353,7 +1353,7 @@ namespace Tests { NMsgBusProxy::EResponseStatus TClient::CreateTableWithUniformShardedIndex(const TString& parent, const NKikimrSchemeOp::TTableDescription &table, const TString& indexName, const TVector<TString> indexColumns, - const TVector<TString> dataColumns, TDuration timeout) + NKikimrSchemeOp::EIndexType type, const TVector<TString> dataColumns, TDuration timeout) { TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation()); auto *op = request->Record.MutableTransaction()->MutableModifyScheme(); @@ -1373,7 +1373,7 @@ namespace Tests { indexDesc->AddDataColumnNames(c); } - indexDesc->SetType(NKikimrSchemeOp::EIndexType::EIndexTypeGlobal); + indexDesc->SetType(type); indexDesc->MutableIndexImplTableDescription()->SetUniformPartitionsCount(16); } diff --git a/ydb/core/testlib/test_client.h b/ydb/core/testlib/test_client.h index 1816a7ea903..57edf869426 100644 --- a/ydb/core/testlib/test_client.h +++ b/ydb/core/testlib/test_client.h @@ -378,7 +378,8 @@ namespace Tests { NMsgBusProxy::EResponseStatus CreateTable(const TString& parent, const NKikimrSchemeOp::TTableDescription &table, TDuration timeout = TDuration::Seconds(5000)); NMsgBusProxy::EResponseStatus CreateTableWithUniformShardedIndex(const TString& parent, const NKikimrSchemeOp::TTableDescription &table, const TString& indexName, - const TVector<TString> indexColumns, const TVector<TString> dataColumns = {}, TDuration timeout = TDuration::Seconds(5000)); + const TVector<TString> indexColumns, NKikimrSchemeOp::EIndexType type, + const TVector<TString> dataColumns = {}, TDuration timeout = TDuration::Seconds(5000)); NMsgBusProxy::EResponseStatus SplitTable(const TString& table, ui64 datashardId, ui64 border, TDuration timeout = TDuration::Seconds(5000)); NMsgBusProxy::EResponseStatus CopyTable(const TString& parent, const TString& name, const TString& src); NMsgBusProxy::EResponseStatus CreateKesus(const TString& parent, const TString& name); |
