diff --git a/ydb/core/base/table_index.cpp b/ydb/core/base/table_index.cpp index 48f7399cf9dc..61a4fbeff92b 100644 --- a/ydb/core/base/table_index.cpp +++ b/ydb/core/base/table_index.cpp @@ -154,9 +154,9 @@ bool IsImplTable(std::string_view tableName) { return Contains(ImplTables, tableName); } -bool IsTmpImplTable(std::string_view tableName) { - // all impl tables that ends with "tmp" should be used only for index creation and dropped when index build is finished - return tableName.ends_with("tmp"); +bool IsBuildImplTable(std::string_view tableName) { + // all impl tables that ends with "build" should be used only for index creation and dropped when index build is finished + return tableName.ends_with("build"); } } diff --git a/ydb/core/base/table_index.h b/ydb/core/base/table_index.h index 13caab312ec2..90b48c40f3c1 100644 --- a/ydb/core/base/table_index.h +++ b/ydb/core/base/table_index.h @@ -26,6 +26,6 @@ TTableColumns CalcTableImplDescription(NKikimrSchemeOp::EIndexType type, const T TVector GetImplTables(NKikimrSchemeOp::EIndexType indexType); bool IsImplTable(std::string_view tableName); -bool IsTmpImplTable(std::string_view tableName); +bool IsBuildImplTable(std::string_view tableName); } diff --git a/ydb/core/base/table_vector_index.h b/ydb/core/base/table_vector_index.h index 1807a20e1d9d..39a0ff7df8f4 100644 --- a/ydb/core/base/table_vector_index.h +++ b/ydb/core/base/table_vector_index.h @@ -14,7 +14,7 @@ inline constexpr const char* LevelTable_EmbeddingColumn = "__ydb_embedding"; inline constexpr const char* PostingTable = "indexImplPostingTable"; inline constexpr const char* PostingTable_ParentIdColumn = LevelTable_ParentIdColumn; -inline constexpr const char* TmpPostingTableSuffix0 = "0tmp"; -inline constexpr const char* TmpPostingTableSuffix1 = "1tmp"; +inline constexpr const char* BuildPostingTableSuffix0 = "0build"; +inline constexpr const char* BuildPostingTableSuffix1 = "1build"; } diff --git a/ydb/core/protos/tx_datashard.proto b/ydb/core/protos/tx_datashard.proto index 46b761202cf9..349a1c0fd074 100644 --- a/ydb/core/protos/tx_datashard.proto +++ b/ydb/core/protos/tx_datashard.proto @@ -1509,10 +1509,10 @@ message TEvLocalKMeansRequest { UNSPECIFIED = 0; SAMPLE = 1; KMEANS = 2; - UPLOAD_MAIN_TO_TMP = 3; + UPLOAD_MAIN_TO_BUILD = 3; UPLOAD_MAIN_TO_POSTING = 4; - UPLOAD_TMP_TO_TMP = 5; - UPLOAD_TMP_TO_POSTING = 6; + UPLOAD_BUILD_TO_BUILD = 5; + UPLOAD_BUILD_TO_POSTING = 6; DONE = 7; }; optional EState Upload = 11; diff --git a/ydb/core/tx/datashard/datashard_ut_local_kmeans.cpp b/ydb/core/tx/datashard/datashard_ut_local_kmeans.cpp index 95bf775a5d2d..b572b129781f 100644 --- a/ydb/core/tx/datashard/datashard_ut_local_kmeans.cpp +++ b/ydb/core/tx/datashard/datashard_ut_local_kmeans.cpp @@ -200,7 +200,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardLocalKMeansScan) { CreateShardedTable(server, sender, "/Root", "table-posting", options); } - static void CreateTmpTable(Tests::TServer::TPtr server, TActorId sender, TShardedTableOptions options, + static void CreateBuildTable(Tests::TServer::TPtr server, TActorId sender, TShardedTableOptions options, const char* name) { options.AllowSystemColumnNames(true); @@ -402,7 +402,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardLocalKMeansScan) { } } - Y_UNIT_TEST (MainToTmp) { + Y_UNIT_TEST (MainToBuild) { TPortManager pm; TServerSettings serverSettings(pm.GetPort(2134)); serverSettings.SetDomainName("Root"); @@ -434,7 +434,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardLocalKMeansScan) { auto create = [&] { CreateLevelTable(server, sender, options); - CreateTmpTable(server, sender, options, "table-posting"); + CreateBuildTable(server, sender, options, "table-posting"); }; create(); auto recreate = [&] { @@ -449,7 +449,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardLocalKMeansScan) { seed = 0; for (auto distance : {VectorIndexSettings::DISTANCE_MANHATTAN, VectorIndexSettings::DISTANCE_EUCLIDEAN}) { auto [level, posting] = - DoLocalKMeans(server, sender, 0, seed, k, NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_MAIN_TO_TMP, + DoLocalKMeans(server, sender, 0, seed, k, NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_MAIN_TO_BUILD, VectorIndexSettings::VECTOR_TYPE_UINT8, distance); UNIT_ASSERT_VALUES_EQUAL(level, "__ydb_parent = 0, __ydb_id = 1, __ydb_embedding = mm\3\n" "__ydb_parent = 0, __ydb_id = 2, __ydb_embedding = 11\3\n"); @@ -464,7 +464,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardLocalKMeansScan) { seed = 111; for (auto distance : {VectorIndexSettings::DISTANCE_MANHATTAN, VectorIndexSettings::DISTANCE_EUCLIDEAN}) { auto [level, posting] = - DoLocalKMeans(server, sender, 0, seed, k, NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_MAIN_TO_TMP, + DoLocalKMeans(server, sender, 0, seed, k, NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_MAIN_TO_BUILD, VectorIndexSettings::VECTOR_TYPE_UINT8, distance); UNIT_ASSERT_VALUES_EQUAL(level, "__ydb_parent = 0, __ydb_id = 1, __ydb_embedding = 11\3\n" "__ydb_parent = 0, __ydb_id = 2, __ydb_embedding = mm\3\n"); @@ -479,7 +479,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardLocalKMeansScan) { for (auto similarity : {VectorIndexSettings::SIMILARITY_INNER_PRODUCT, VectorIndexSettings::SIMILARITY_COSINE}) { auto [level, posting] = - DoLocalKMeans(server, sender, 0, seed, k, NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_MAIN_TO_TMP, + DoLocalKMeans(server, sender, 0, seed, k, NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_MAIN_TO_BUILD, VectorIndexSettings::VECTOR_TYPE_UINT8, similarity); UNIT_ASSERT_VALUES_EQUAL(level, "__ydb_parent = 0, __ydb_id = 1, __ydb_embedding = II\3\n"); UNIT_ASSERT_VALUES_EQUAL(posting, "__ydb_parent = 1, key = 1, embedding = \x30\x30\3, data = one\n" @@ -492,7 +492,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardLocalKMeansScan) { seed = 13; { auto [level, posting] = - DoLocalKMeans(server, sender, 0, seed, k, NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_MAIN_TO_TMP, + DoLocalKMeans(server, sender, 0, seed, k, NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_MAIN_TO_BUILD, VectorIndexSettings::VECTOR_TYPE_UINT8, VectorIndexSettings::DISTANCE_COSINE); UNIT_ASSERT_VALUES_EQUAL(level, "__ydb_parent = 0, __ydb_id = 1, __ydb_embedding = II\3\n"); UNIT_ASSERT_VALUES_EQUAL(posting, "__ydb_parent = 1, key = 1, embedding = \x30\x30\3, data = one\n" @@ -504,7 +504,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardLocalKMeansScan) { } } - Y_UNIT_TEST (TmpToPosting) { + Y_UNIT_TEST (BuildToPosting) { TPortManager pm; TServerSettings serverSettings(pm.GetPort(2134)); serverSettings.SetDomainName("Root"); @@ -521,7 +521,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardLocalKMeansScan) { options.EnableOutOfOrder(true); // TODO(mbkkt) what is it? options.Shards(1); - CreateTmpTable(server, sender, options, "table-main"); + CreateBuildTable(server, sender, options, "table-main"); // Upsert some initial values ExecSQL(server, sender, R"( @@ -553,7 +553,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardLocalKMeansScan) { seed = 0; for (auto distance : {VectorIndexSettings::DISTANCE_MANHATTAN, VectorIndexSettings::DISTANCE_EUCLIDEAN}) { auto [level, posting] = DoLocalKMeans(server, sender, 40, seed, k, - NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_TMP_TO_POSTING, + NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_BUILD_TO_POSTING, VectorIndexSettings::VECTOR_TYPE_UINT8, distance); UNIT_ASSERT_VALUES_EQUAL(level, "__ydb_parent = 40, __ydb_id = 41, __ydb_embedding = mm\3\n" "__ydb_parent = 40, __ydb_id = 42, __ydb_embedding = 11\3\n"); @@ -568,7 +568,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardLocalKMeansScan) { seed = 111; for (auto distance : {VectorIndexSettings::DISTANCE_MANHATTAN, VectorIndexSettings::DISTANCE_EUCLIDEAN}) { auto [level, posting] = DoLocalKMeans(server, sender, 40, seed, k, - NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_TMP_TO_POSTING, + NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_BUILD_TO_POSTING, VectorIndexSettings::VECTOR_TYPE_UINT8, distance); UNIT_ASSERT_VALUES_EQUAL(level, "__ydb_parent = 40, __ydb_id = 41, __ydb_embedding = 11\3\n" "__ydb_parent = 40, __ydb_id = 42, __ydb_embedding = mm\3\n"); @@ -583,7 +583,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardLocalKMeansScan) { for (auto similarity : {VectorIndexSettings::SIMILARITY_INNER_PRODUCT, VectorIndexSettings::SIMILARITY_COSINE}) { auto [level, posting] = DoLocalKMeans(server, sender, 40, seed, k, - NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_TMP_TO_POSTING, + NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_BUILD_TO_POSTING, VectorIndexSettings::VECTOR_TYPE_UINT8, similarity); UNIT_ASSERT_VALUES_EQUAL(level, "__ydb_parent = 40, __ydb_id = 41, __ydb_embedding = II\3\n"); UNIT_ASSERT_VALUES_EQUAL(posting, "__ydb_parent = 41, key = 1, data = one\n" @@ -596,7 +596,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardLocalKMeansScan) { seed = 13; { auto [level, posting] = DoLocalKMeans( - server, sender, 40, seed, k, NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_TMP_TO_POSTING, + server, sender, 40, seed, k, NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_BUILD_TO_POSTING, VectorIndexSettings::VECTOR_TYPE_UINT8, VectorIndexSettings::DISTANCE_COSINE); UNIT_ASSERT_VALUES_EQUAL(level, "__ydb_parent = 40, __ydb_id = 41, __ydb_embedding = II\3\n"); UNIT_ASSERT_VALUES_EQUAL(posting, "__ydb_parent = 41, key = 1, data = one\n" @@ -608,7 +608,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardLocalKMeansScan) { } } - Y_UNIT_TEST (TmpToTmp) { + Y_UNIT_TEST (BuildToBuild) { TPortManager pm; TServerSettings serverSettings(pm.GetPort(2134)); serverSettings.SetDomainName("Root"); @@ -625,7 +625,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardLocalKMeansScan) { options.EnableOutOfOrder(true); // TODO(mbkkt) what is it? options.Shards(1); - CreateTmpTable(server, sender, options, "table-main"); + CreateBuildTable(server, sender, options, "table-main"); // Upsert some initial values ExecSQL(server, sender, R"( @@ -642,7 +642,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardLocalKMeansScan) { auto create = [&] { CreateLevelTable(server, sender, options); - CreateTmpTable(server, sender, options, "table-posting"); + CreateBuildTable(server, sender, options, "table-posting"); }; create(); auto recreate = [&] { @@ -657,7 +657,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardLocalKMeansScan) { seed = 0; for (auto distance : {VectorIndexSettings::DISTANCE_MANHATTAN, VectorIndexSettings::DISTANCE_EUCLIDEAN}) { auto [level, posting] = - DoLocalKMeans(server, sender, 40, seed, k, NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_TMP_TO_TMP, + DoLocalKMeans(server, sender, 40, seed, k, NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_BUILD_TO_BUILD, VectorIndexSettings::VECTOR_TYPE_UINT8, distance); UNIT_ASSERT_VALUES_EQUAL(level, "__ydb_parent = 40, __ydb_id = 41, __ydb_embedding = mm\3\n" "__ydb_parent = 40, __ydb_id = 42, __ydb_embedding = 11\3\n"); @@ -672,7 +672,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardLocalKMeansScan) { seed = 111; for (auto distance : {VectorIndexSettings::DISTANCE_MANHATTAN, VectorIndexSettings::DISTANCE_EUCLIDEAN}) { auto [level, posting] = - DoLocalKMeans(server, sender, 40, seed, k, NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_TMP_TO_TMP, + DoLocalKMeans(server, sender, 40, seed, k, NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_BUILD_TO_BUILD, VectorIndexSettings::VECTOR_TYPE_UINT8, distance); UNIT_ASSERT_VALUES_EQUAL(level, "__ydb_parent = 40, __ydb_id = 41, __ydb_embedding = 11\3\n" "__ydb_parent = 40, __ydb_id = 42, __ydb_embedding = mm\3\n"); @@ -687,7 +687,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardLocalKMeansScan) { for (auto similarity : {VectorIndexSettings::SIMILARITY_INNER_PRODUCT, VectorIndexSettings::SIMILARITY_COSINE}) { auto [level, posting] = - DoLocalKMeans(server, sender, 40, seed, k, NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_TMP_TO_TMP, + DoLocalKMeans(server, sender, 40, seed, k, NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_BUILD_TO_BUILD, VectorIndexSettings::VECTOR_TYPE_UINT8, similarity); UNIT_ASSERT_VALUES_EQUAL(level, "__ydb_parent = 40, __ydb_id = 41, __ydb_embedding = II\3\n"); UNIT_ASSERT_VALUES_EQUAL(posting, "__ydb_parent = 41, key = 1, embedding = \x30\x30\3, data = one\n" @@ -700,7 +700,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardLocalKMeansScan) { seed = 13; { auto [level, posting] = - DoLocalKMeans(server, sender, 40, seed, k, NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_TMP_TO_TMP, + DoLocalKMeans(server, sender, 40, seed, k, NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_BUILD_TO_BUILD, VectorIndexSettings::VECTOR_TYPE_UINT8, VectorIndexSettings::DISTANCE_COSINE); UNIT_ASSERT_VALUES_EQUAL(level, "__ydb_parent = 40, __ydb_id = 41, __ydb_embedding = II\3\n"); UNIT_ASSERT_VALUES_EQUAL(posting, "__ydb_parent = 41, key = 1, embedding = \x30\x30\3, data = one\n" diff --git a/ydb/core/tx/datashard/datashard_ut_reshuffle_kmeans.cpp b/ydb/core/tx/datashard/datashard_ut_reshuffle_kmeans.cpp index f79d0159c6d5..e419fffc766c 100644 --- a/ydb/core/tx/datashard/datashard_ut_reshuffle_kmeans.cpp +++ b/ydb/core/tx/datashard/datashard_ut_reshuffle_kmeans.cpp @@ -153,12 +153,14 @@ Y_UNIT_TEST_SUITE (TTxDataShardReshuffleKMeansScan) { return std::move(posting); } - static void DropTable(Tests::TServer::TPtr server, TActorId sender, const char* name) { + static void DropTable(Tests::TServer::TPtr server, TActorId sender, const char* name) + { ui64 txId = AsyncDropTable(server, sender, "/Root", name); WaitTxNotification(server, sender, txId); } - static void CreateMainTable(Tests::TServer::TPtr server, TActorId sender, TShardedTableOptions options) { + static void CreateMainTable(Tests::TServer::TPtr server, TActorId sender, TShardedTableOptions options) + { options.AllowSystemColumnNames(false); options.Columns({ {"key", "Uint32", true, true}, @@ -168,7 +170,8 @@ Y_UNIT_TEST_SUITE (TTxDataShardReshuffleKMeansScan) { CreateShardedTable(server, sender, "/Root", "table-main", options); } - static void CreatePostingTable(Tests::TServer::TPtr server, TActorId sender, TShardedTableOptions options) { + static void CreatePostingTable(Tests::TServer::TPtr server, TActorId sender, TShardedTableOptions options) + { options.AllowSystemColumnNames(true); options.Columns({ {PostingTable_ParentIdColumn, "Uint32", true, true}, @@ -178,7 +181,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardReshuffleKMeansScan) { CreateShardedTable(server, sender, "/Root", "table-posting", options); } - static void CreateTmpTable(Tests::TServer::TPtr server, TActorId sender, TShardedTableOptions options, + static void CreateBuildTable(Tests::TServer::TPtr server, TActorId sender, TShardedTableOptions options, const char* name) { options.AllowSystemColumnNames(true); @@ -338,8 +341,8 @@ Y_UNIT_TEST_SUITE (TTxDataShardReshuffleKMeansScan) { "__ydb_parent = 2, key = 5, data = five\n"); recreate(); } - for (auto similarity : - {VectorIndexSettings::SIMILARITY_INNER_PRODUCT, VectorIndexSettings::SIMILARITY_COSINE}) { + for (auto similarity : {VectorIndexSettings::SIMILARITY_INNER_PRODUCT, VectorIndexSettings::SIMILARITY_COSINE}) + { std::vector level = { "II\3", }; @@ -369,7 +372,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardReshuffleKMeansScan) { } } - Y_UNIT_TEST (MainToTmp) { + Y_UNIT_TEST (MainToBuild) { TPortManager pm; TServerSettings serverSettings(pm.GetPort(2134)); serverSettings.SetDomainName("Root"); @@ -399,7 +402,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardReshuffleKMeansScan) { "(4, \"\x65\x65\3\", \"four\")," "(5, \"\x75\x75\3\", \"five\");"); - auto create = [&] { CreateTmpTable(server, sender, options, "table-posting"); }; + auto create = [&] { CreateBuildTable(server, sender, options, "table-posting"); }; create(); auto recreate = [&] { DropTable(server, sender, "table-posting"); @@ -412,7 +415,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardReshuffleKMeansScan) { "11\3", }; auto posting = DoReshuffleKMeans(server, sender, 0, level, - NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_MAIN_TO_TMP, + NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_MAIN_TO_BUILD, VectorIndexSettings::VECTOR_TYPE_UINT8, distance); UNIT_ASSERT_VALUES_EQUAL(posting, "__ydb_parent = 1, key = 4, embedding = \x65\x65\3, data = four\n" "__ydb_parent = 1, key = 5, embedding = \x75\x75\3, data = five\n" @@ -427,7 +430,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardReshuffleKMeansScan) { "mm\3", }; auto posting = DoReshuffleKMeans(server, sender, 0, level, - NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_MAIN_TO_TMP, + NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_MAIN_TO_BUILD, VectorIndexSettings::VECTOR_TYPE_UINT8, distance); UNIT_ASSERT_VALUES_EQUAL(posting, "__ydb_parent = 1, key = 1, embedding = \x30\x30\3, data = one\n" "__ydb_parent = 1, key = 2, embedding = \x31\x31\3, data = two\n" @@ -436,13 +439,13 @@ Y_UNIT_TEST_SUITE (TTxDataShardReshuffleKMeansScan) { "__ydb_parent = 2, key = 5, embedding = \x75\x75\3, data = five\n"); recreate(); } - for (auto similarity : - {VectorIndexSettings::SIMILARITY_INNER_PRODUCT, VectorIndexSettings::SIMILARITY_COSINE}) { + for (auto similarity : {VectorIndexSettings::SIMILARITY_INNER_PRODUCT, VectorIndexSettings::SIMILARITY_COSINE}) + { std::vector level = { "II\3", }; auto posting = DoReshuffleKMeans(server, sender, 0, level, - NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_MAIN_TO_TMP, + NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_MAIN_TO_BUILD, VectorIndexSettings::VECTOR_TYPE_UINT8, similarity); UNIT_ASSERT_VALUES_EQUAL(posting, "__ydb_parent = 1, key = 1, embedding = \x30\x30\3, data = one\n" "__ydb_parent = 1, key = 2, embedding = \x31\x31\3, data = two\n" @@ -456,7 +459,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardReshuffleKMeansScan) { "II\3", }; auto posting = DoReshuffleKMeans( - server, sender, 0, level, NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_MAIN_TO_TMP, + server, sender, 0, level, NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_MAIN_TO_BUILD, VectorIndexSettings::VECTOR_TYPE_UINT8, VectorIndexSettings::DISTANCE_COSINE); UNIT_ASSERT_VALUES_EQUAL(posting, "__ydb_parent = 1, key = 1, embedding = \x30\x30\3, data = one\n" "__ydb_parent = 1, key = 2, embedding = \x31\x31\3, data = two\n" @@ -467,7 +470,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardReshuffleKMeansScan) { } } - Y_UNIT_TEST (TmpToPosting) { + Y_UNIT_TEST (BuildToPosting) { TPortManager pm; TServerSettings serverSettings(pm.GetPort(2134)); serverSettings.SetDomainName("Root"); @@ -484,7 +487,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardReshuffleKMeansScan) { options.EnableOutOfOrder(true); // TODO(mbkkt) what is it? options.Shards(1); - CreateTmpTable(server, sender, options, "table-main"); + CreateBuildTable(server, sender, options, "table-main"); // Upsert some initial values ExecSQL(server, sender, R"( @@ -512,7 +515,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardReshuffleKMeansScan) { "11\3", }; auto posting = DoReshuffleKMeans(server, sender, 40, level, - NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_TMP_TO_POSTING, + NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_BUILD_TO_POSTING, VectorIndexSettings::VECTOR_TYPE_UINT8, distance); UNIT_ASSERT_VALUES_EQUAL(posting, "__ydb_parent = 41, key = 4, data = four\n" "__ydb_parent = 41, key = 5, data = five\n" @@ -527,7 +530,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardReshuffleKMeansScan) { "mm\3", }; auto posting = DoReshuffleKMeans(server, sender, 40, level, - NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_TMP_TO_POSTING, + NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_BUILD_TO_POSTING, VectorIndexSettings::VECTOR_TYPE_UINT8, distance); UNIT_ASSERT_VALUES_EQUAL(posting, "__ydb_parent = 41, key = 1, data = one\n" "__ydb_parent = 41, key = 2, data = two\n" @@ -536,13 +539,13 @@ Y_UNIT_TEST_SUITE (TTxDataShardReshuffleKMeansScan) { "__ydb_parent = 42, key = 5, data = five\n"); recreate(); } - for (auto similarity : - {VectorIndexSettings::SIMILARITY_INNER_PRODUCT, VectorIndexSettings::SIMILARITY_COSINE}) { + for (auto similarity : {VectorIndexSettings::SIMILARITY_INNER_PRODUCT, VectorIndexSettings::SIMILARITY_COSINE}) + { std::vector level = { "II\3", }; auto posting = DoReshuffleKMeans(server, sender, 40, level, - NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_TMP_TO_POSTING, + NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_BUILD_TO_POSTING, VectorIndexSettings::VECTOR_TYPE_UINT8, similarity); UNIT_ASSERT_VALUES_EQUAL(posting, "__ydb_parent = 41, key = 1, data = one\n" "__ydb_parent = 41, key = 2, data = two\n" @@ -556,7 +559,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardReshuffleKMeansScan) { "II\3", }; auto posting = DoReshuffleKMeans( - server, sender, 40, level, NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_TMP_TO_POSTING, + server, sender, 40, level, NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_BUILD_TO_POSTING, VectorIndexSettings::VECTOR_TYPE_UINT8, VectorIndexSettings::DISTANCE_COSINE); UNIT_ASSERT_VALUES_EQUAL(posting, "__ydb_parent = 41, key = 1, data = one\n" "__ydb_parent = 41, key = 2, data = two\n" @@ -567,7 +570,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardReshuffleKMeansScan) { } } - Y_UNIT_TEST (TmpToTmp) { + Y_UNIT_TEST (BuildToBuild) { TPortManager pm; TServerSettings serverSettings(pm.GetPort(2134)); serverSettings.SetDomainName("Root"); @@ -584,7 +587,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardReshuffleKMeansScan) { options.EnableOutOfOrder(true); // TODO(mbkkt) what is it? options.Shards(1); - CreateTmpTable(server, sender, options, "table-main"); + CreateBuildTable(server, sender, options, "table-main"); // Upsert some initial values ExecSQL(server, sender, R"( @@ -599,7 +602,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardReshuffleKMeansScan) { "(40, 5, \"\x75\x75\3\", \"five\")," "(41, 5, \"\x75\x75\3\", \"five\");"); - auto create = [&] { CreateTmpTable(server, sender, options, "table-posting"); }; + auto create = [&] { CreateBuildTable(server, sender, options, "table-posting"); }; create(); auto recreate = [&] { DropTable(server, sender, "table-posting"); @@ -612,7 +615,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardReshuffleKMeansScan) { "11\3", }; auto posting = DoReshuffleKMeans(server, sender, 40, level, - NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_TMP_TO_TMP, + NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_BUILD_TO_BUILD, VectorIndexSettings::VECTOR_TYPE_UINT8, distance); UNIT_ASSERT_VALUES_EQUAL(posting, "__ydb_parent = 41, key = 4, embedding = \x65\x65\3, data = four\n" "__ydb_parent = 41, key = 5, embedding = \x75\x75\3, data = five\n" @@ -627,7 +630,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardReshuffleKMeansScan) { "mm\3", }; auto posting = DoReshuffleKMeans(server, sender, 40, level, - NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_TMP_TO_TMP, + NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_BUILD_TO_BUILD, VectorIndexSettings::VECTOR_TYPE_UINT8, distance); UNIT_ASSERT_VALUES_EQUAL(posting, "__ydb_parent = 41, key = 1, embedding = \x30\x30\3, data = one\n" "__ydb_parent = 41, key = 2, embedding = \x31\x31\3, data = two\n" @@ -636,13 +639,13 @@ Y_UNIT_TEST_SUITE (TTxDataShardReshuffleKMeansScan) { "__ydb_parent = 42, key = 5, embedding = \x75\x75\3, data = five\n"); recreate(); } - for (auto similarity : - {VectorIndexSettings::SIMILARITY_INNER_PRODUCT, VectorIndexSettings::SIMILARITY_COSINE}) { + for (auto similarity : {VectorIndexSettings::SIMILARITY_INNER_PRODUCT, VectorIndexSettings::SIMILARITY_COSINE}) + { std::vector level = { "II\3", }; auto posting = DoReshuffleKMeans(server, sender, 40, level, - NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_TMP_TO_TMP, + NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_BUILD_TO_BUILD, VectorIndexSettings::VECTOR_TYPE_UINT8, similarity); UNIT_ASSERT_VALUES_EQUAL(posting, "__ydb_parent = 41, key = 1, embedding = \x30\x30\3, data = one\n" "__ydb_parent = 41, key = 2, embedding = \x31\x31\3, data = two\n" @@ -656,7 +659,7 @@ Y_UNIT_TEST_SUITE (TTxDataShardReshuffleKMeansScan) { "II\3", }; auto posting = DoReshuffleKMeans( - server, sender, 40, level, NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_TMP_TO_TMP, + server, sender, 40, level, NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_BUILD_TO_BUILD, VectorIndexSettings::VECTOR_TYPE_UINT8, VectorIndexSettings::DISTANCE_COSINE); UNIT_ASSERT_VALUES_EQUAL(posting, "__ydb_parent = 41, key = 1, embedding = \x30\x30\3, data = one\n" "__ydb_parent = 41, key = 2, embedding = \x31\x31\3, data = two\n" diff --git a/ydb/core/tx/datashard/kmeans_helper.cpp b/ydb/core/tx/datashard/kmeans_helper.cpp index 9bd4a4296b68..1d6e116c0707 100644 --- a/ydb/core/tx/datashard/kmeans_helper.cpp +++ b/ydb/core/tx/datashard/kmeans_helper.cpp @@ -27,7 +27,7 @@ NTable::TLead CreateLeadFrom(const TTableRange& range) { return lead; } -void AddRowMain2Tmp(TBufferData& buffer, ui32 parent, TArrayRef key, const NTable::TRowState& row) { +void AddRowMain2Build(TBufferData& buffer, ui32 parent, TArrayRef key, const NTable::TRowState& row) { std::array cells; cells[0] = TCell::Make(parent); auto pk = TSerializedCellVec::Serialize(cells); @@ -46,7 +46,7 @@ void AddRowMain2Posting(TBufferData& buffer, ui32 parent, TArrayRef TSerializedCellVec::Serialize((*row).Slice(dataPos))); } -void AddRowTmp2Tmp(TBufferData& buffer, ui32 parent, TArrayRef key, const NTable::TRowState& row) { +void AddRowBuild2Build(TBufferData& buffer, ui32 parent, TArrayRef key, const NTable::TRowState& row) { std::array cells; cells[0] = TCell::Make(parent); auto pk = TSerializedCellVec::Serialize(cells); @@ -54,7 +54,7 @@ void AddRowTmp2Tmp(TBufferData& buffer, ui32 parent, TArrayRef key, buffer.AddRow(TSerializedCellVec{key}, TSerializedCellVec{std::move(pk)}, TSerializedCellVec::Serialize(*row)); } -void AddRowTmp2Posting(TBufferData& buffer, ui32 parent, TArrayRef key, const NTable::TRowState& row, +void AddRowBuild2Posting(TBufferData& buffer, ui32 parent, TArrayRef key, const NTable::TRowState& row, ui32 dataPos) { std::array cells; @@ -109,12 +109,12 @@ MakeUploadTypes(const TUserTable& table, NKikimrTxDataShard::TEvLocalKMeansReque addType(table.Columns.at(column).Name); } switch (uploadState) { - case NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_MAIN_TO_TMP: - case NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_TMP_TO_TMP: + case NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_MAIN_TO_BUILD: + case NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_BUILD_TO_BUILD: addType(embedding); [[fallthrough]]; case NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_MAIN_TO_POSTING: - case NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_TMP_TO_POSTING: { + case NKikimrTxDataShard::TEvLocalKMeansRequest::UPLOAD_BUILD_TO_POSTING: { for (const auto& column : data) { addType(column); } diff --git a/ydb/core/tx/datashard/kmeans_helper.h b/ydb/core/tx/datashard/kmeans_helper.h index c6b0a2f86416..2c45b07eda35 100644 --- a/ydb/core/tx/datashard/kmeans_helper.h +++ b/ydb/core/tx/datashard/kmeans_helper.h @@ -187,14 +187,14 @@ ui32 FeedEmbedding(const TCalculation& calculation, std::span key, const NTable::TRowState& row); +void AddRowMain2Build(TBufferData& buffer, ui32 parent, TArrayRef key, const NTable::TRowState& row); void AddRowMain2Posting(TBufferData& buffer, ui32 parent, TArrayRef key, const NTable::TRowState& row, ui32 dataPos); -void AddRowTmp2Tmp(TBufferData& buffer, ui32 parent, TArrayRef key, const NTable::TRowState& row); +void AddRowBuild2Build(TBufferData& buffer, ui32 parent, TArrayRef key, const NTable::TRowState& row); -void AddRowTmp2Posting(TBufferData& buffer, ui32 parent, TArrayRef key, const NTable::TRowState& row, +void AddRowBuild2Posting(TBufferData& buffer, ui32 parent, TArrayRef key, const NTable::TRowState& row, ui32 dataPos); TTags MakeUploadTags(const TUserTable& table, const TProtoStringType& embedding, diff --git a/ydb/core/tx/datashard/local_kmeans.cpp b/ydb/core/tx/datashard/local_kmeans.cpp index 5bd92d946162..24eacc00b9b8 100644 --- a/ydb/core/tx/datashard/local_kmeans.cpp +++ b/ydb/core/tx/datashard/local_kmeans.cpp @@ -106,7 +106,8 @@ class TLocalKMeansScanBase: public TActor, public NTable:: TAutoPtr Response; public: - static constexpr NKikimrServices::TActivity::EType ActorActivityType() { + static constexpr NKikimrServices::TActivity::EType ActorActivityType() + { return NKikimrServices::TActivity::LOCAL_KMEANS_SCAN_ACTOR; } @@ -143,7 +144,8 @@ class TLocalKMeansScanBase: public TActor, public NTable:: NextTypes = MakeUploadTypes(table, UploadState, embedding, data); } - TInitialState Prepare(IDriver* driver, TIntrusiveConstPtr) noexcept final { + TInitialState Prepare(IDriver* driver, TIntrusiveConstPtr) noexcept final + { TActivationContext::AsActorContext().RegisterWithSameMailbox(this); LOG_T("Prepare " << Debug()); @@ -151,7 +153,8 @@ class TLocalKMeansScanBase: public TActor, public NTable:: return {EScan::Feed, {}}; } - TAutoPtr Finish(EAbort abort) noexcept final { + TAutoPtr Finish(EAbort abort) noexcept final + { LOG_T("Finish " << Debug()); if (Uploader) { @@ -175,11 +178,13 @@ class TLocalKMeansScanBase: public TActor, public NTable:: return nullptr; } - void Describe(IOutputStream& out) const noexcept final { + void Describe(IOutputStream& out) const noexcept final + { out << Debug(); } - TString Debug() const { + TString Debug() const + { auto builder = TStringBuilder() << " TLocalKMeansScan"; if (Response) { auto& r = Response->Record; @@ -189,7 +194,8 @@ class TLocalKMeansScanBase: public TActor, public NTable:: << " ReadBuf size: " << ReadBuf.Size() << " WriteBuf size: " << WriteBuf.Size() << " "; } - EScan PageFault() noexcept final { + EScan PageFault() noexcept final + { LOG_T("PageFault " << Debug()); if (!ReadBuf.IsEmpty() && WriteBuf.IsEmpty()) { @@ -201,7 +207,8 @@ class TLocalKMeansScanBase: public TActor, public NTable:: } protected: - STFUNC(StateWork) { + STFUNC(StateWork) + { switch (ev->GetTypeRewrite()) { HFunc(TEvTxUserProxy::TEvUploadRowsResponse, Handle); CFunc(TEvents::TSystem::Wakeup, HandleWakeup); @@ -211,7 +218,8 @@ class TLocalKMeansScanBase: public TActor, public NTable:: } } - void HandleWakeup(const NActors::TActorContext& /*ctx*/) { + void HandleWakeup(const NActors::TActorContext& /*ctx*/) + { LOG_T("Retry upload " << Debug()); if (!WriteBuf.IsEmpty()) { @@ -219,7 +227,8 @@ class TLocalKMeansScanBase: public TActor, public NTable:: } } - void Handle(TEvTxUserProxy::TEvUploadRowsResponse::TPtr& ev, const TActorContext& ctx) { + void Handle(TEvTxUserProxy::TEvUploadRowsResponse::TPtr& ev, const TActorContext& ctx) + { LOG_T("Handle TEvUploadRowsResponse " << Debug() << " Uploader: " << Uploader.ToString() << " ev->Sender: " << ev->Sender.ToString()); @@ -256,7 +265,8 @@ class TLocalKMeansScanBase: public TActor, public NTable:: Driver->Touch(EScan::Final); } - EScan FeedUpload() { + EScan FeedUpload() + { if (!ReadBuf.IsReachLimits(Limits)) { return EScan::Feed; } @@ -268,11 +278,13 @@ class TLocalKMeansScanBase: public TActor, public NTable:: return EScan::Feed; } - ui64 GetProbability() { + ui64 GetProbability() + { return Rng.GenRand64(); } - void Upload(bool isRetry) { + void Upload(bool isRetry) + { if (isRetry) { ++RetryCount; } else { @@ -290,7 +302,8 @@ class TLocalKMeansScanBase: public TActor, public NTable:: Uploader = this->Register(actor); } - void UploadSample() { + void UploadSample() + { Y_ASSERT(ReadBuf.IsEmpty()); Y_ASSERT(WriteBuf.IsEmpty()); std::array pk; @@ -320,12 +333,13 @@ class TLocalKMeansScan final: public TLocalKMeansScanBase, private TCalculation< public: TLocalKMeansScan(const TUserTable& table, TLead&& lead, NKikimrTxDataShard::TEvLocalKMeansRequest& request, const TActorId& responseActorId, TAutoPtr&& response) - : TLocalKMeansScanBase{table, std::move(lead), request, responseActorId, std::move(response)} + : TLocalKMeansScanBase{table, std::move(lead), request, responseActorId, std::move(response)} { this->Dimensions = request.GetSettings().vector_dimension(); } - EScan Seek(TLead& lead, ui64 seq) noexcept final { + EScan Seek(TLead& lead, ui64 seq) noexcept final + { LOG_T("Seek " << Debug()); if (State == UploadState) { if (!WriteBuf.IsEmpty()) { @@ -374,28 +388,30 @@ class TLocalKMeansScan final: public TLocalKMeansScanBase, private TCalculation< return EScan::Feed; } - EScan Feed(TArrayRef key, const TRow& row) noexcept final { + EScan Feed(TArrayRef key, const TRow& row) noexcept final + { LOG_T("Feed " << Debug()); switch (State) { case EState::SAMPLE: return FeedSample(row); case EState::KMEANS: return FeedKMeans(row); - case EState::UPLOAD_MAIN_TO_TMP: - return FeedUploadMain2Tmp(key, row); + case EState::UPLOAD_MAIN_TO_BUILD: + return FeedUploadMain2Build(key, row); case EState::UPLOAD_MAIN_TO_POSTING: return FeedUploadMain2Posting(key, row); - case EState::UPLOAD_TMP_TO_TMP: - return FeedUploadTmp2Tmp(key, row); - case EState::UPLOAD_TMP_TO_POSTING: - return FeedUploadTmp2Posting(key, row); + case EState::UPLOAD_BUILD_TO_BUILD: + return FeedUploadBuild2Build(key, row); + case EState::UPLOAD_BUILD_TO_POSTING: + return FeedUploadBuild2Posting(key, row); default: return EScan::Final; } } private: - bool InitAggregatedClusters() { + bool InitAggregatedClusters() + { if (Clusters.size() == 0) { return false; } @@ -413,7 +429,8 @@ class TLocalKMeansScan final: public TLocalKMeansScanBase, private TCalculation< return true; } - void AggregateToCluster(ui32 pos, const char* embedding) { + void AggregateToCluster(ui32 pos, const char* embedding) + { if (pos >= K) { return; } @@ -425,7 +442,8 @@ class TLocalKMeansScan final: public TLocalKMeansScanBase, private TCalculation< ++aggregate.Count; } - void RecomputeClusters(bool last) { + void RecomputeClusters(bool last) + { auto r = Clusters.begin(); auto w = r; for (auto& aggregate : AggregatedClusters) { @@ -445,7 +463,8 @@ class TLocalKMeansScan final: public TLocalKMeansScanBase, private TCalculation< Clusters.erase(w, Clusters.end()); } - EScan FeedSample(const TRow& row) noexcept { + EScan FeedSample(const TRow& row) noexcept + { Y_ASSERT(row.Size() == 1); const auto embedding = row.Get(0).AsRef(); ReadStats.Rows += 1; @@ -473,23 +492,26 @@ class TLocalKMeansScan final: public TLocalKMeansScanBase, private TCalculation< return MaxProbability != 0 ? EScan::Feed : EScan::Reset; } - EScan FeedKMeans(const TRow& row) noexcept { + EScan FeedKMeans(const TRow& row) noexcept + { Y_ASSERT(row.Size() == 1); const ui32 pos = FeedEmbedding(*this, Clusters, row, 0, ReadStats); AggregateToCluster(pos, row.Get(0).Data()); return EScan::Feed; } - EScan FeedUploadMain2Tmp(TArrayRef key, const TRow& row) noexcept { + EScan FeedUploadMain2Build(TArrayRef key, const TRow& row) noexcept + { const ui32 pos = FeedEmbedding(*this, Clusters, row, EmbeddingPos, ReadStats); if (pos > K) { return EScan::Feed; } - AddRowMain2Tmp(ReadBuf, Child + pos, key, row); + AddRowMain2Build(ReadBuf, Child + pos, key, row); return FeedUpload(); } - EScan FeedUploadMain2Posting(TArrayRef key, const TRow& row) noexcept { + EScan FeedUploadMain2Posting(TArrayRef key, const TRow& row) noexcept + { const ui32 pos = FeedEmbedding(*this, Clusters, row, EmbeddingPos, ReadStats); if (pos > K) { return EScan::Feed; @@ -498,21 +520,23 @@ class TLocalKMeansScan final: public TLocalKMeansScanBase, private TCalculation< return FeedUpload(); } - EScan FeedUploadTmp2Tmp(TArrayRef key, const TRow& row) noexcept { + EScan FeedUploadBuild2Build(TArrayRef key, const TRow& row) noexcept + { const ui32 pos = FeedEmbedding(*this, Clusters, row, EmbeddingPos, ReadStats); if (pos > K) { return EScan::Feed; } - AddRowTmp2Tmp(ReadBuf, Child + pos, key, row); + AddRowBuild2Build(ReadBuf, Child + pos, key, row); return FeedUpload(); } - EScan FeedUploadTmp2Posting(TArrayRef key, const TRow& row) noexcept { + EScan FeedUploadBuild2Posting(TArrayRef key, const TRow& row) noexcept + { const ui32 pos = FeedEmbedding(*this, Clusters, row, EmbeddingPos, ReadStats); if (pos > K) { return EScan::Feed; } - AddRowTmp2Posting(ReadBuf, Child + pos, key, row, DataPos); + AddRowBuild2Posting(ReadBuf, Child + pos, key, row, DataPos); return FeedUpload(); } }; @@ -521,27 +545,31 @@ class TDataShard::TTxHandleSafeLocalKMeansScan final: public NTabletFlatExecutor public: TTxHandleSafeLocalKMeansScan(TDataShard* self, TEvDataShard::TEvLocalKMeansRequest::TPtr&& ev) : TTransactionBase(self) - , Ev(std::move(ev)) + , Ev(std::move(ev)) { } - bool Execute(TTransactionContext&, const TActorContext& ctx) final { + bool Execute(TTransactionContext&, const TActorContext& ctx) final + { Self->HandleSafe(Ev, ctx); return true; } - void Complete(const TActorContext&) final { + void Complete(const TActorContext&) final + { } private: TEvDataShard::TEvLocalKMeansRequest::TPtr Ev; }; -void TDataShard::Handle(TEvDataShard::TEvLocalKMeansRequest::TPtr& ev, const TActorContext&) { +void TDataShard::Handle(TEvDataShard::TEvLocalKMeansRequest::TPtr& ev, const TActorContext&) +{ Execute(new TTxHandleSafeLocalKMeansScan(this, std::move(ev))); } -void TDataShard::HandleSafe(TEvDataShard::TEvLocalKMeansRequest::TPtr& ev, const TActorContext& ctx) { +void TDataShard::HandleSafe(TEvDataShard::TEvLocalKMeansRequest::TPtr& ev, const TActorContext& ctx) +{ auto& record = ev->Get()->Record; TRowVersion rowVersion(record.GetSnapshotStep(), record.GetSnapshotTxId()); diff --git a/ydb/core/tx/datashard/reshuffle_kmeans.cpp b/ydb/core/tx/datashard/reshuffle_kmeans.cpp index 398f209280f8..353766085a3b 100644 --- a/ydb/core/tx/datashard/reshuffle_kmeans.cpp +++ b/ydb/core/tx/datashard/reshuffle_kmeans.cpp @@ -68,7 +68,8 @@ class TReshuffleKMeansScanBase: public TActor, public TAutoPtr Response; public: - static constexpr NKikimrServices::TActivity::EType ActorActivityType() { + static constexpr NKikimrServices::TActivity::EType ActorActivityType() + { return NKikimrServices::TActivity::RESHUFFLE_KMEANS_SCAN_ACTOR; } @@ -85,7 +86,7 @@ class TReshuffleKMeansScanBase: public TActor, public , Clusters{request.GetClusters().begin(), request.GetClusters().end()} , TargetTable{request.GetPostingName()} , ResponseActorId{responseActorId} - , Response{std::move(response)} + , Response{std::move(response)} { const auto& embedding = request.GetEmbeddingColumn(); const auto& data = request.GetDataColumns(); @@ -96,7 +97,8 @@ class TReshuffleKMeansScanBase: public TActor, public TargetTypes = MakeUploadTypes(table, UploadState, embedding, data); } - TInitialState Prepare(IDriver* driver, TIntrusiveConstPtr) noexcept final { + TInitialState Prepare(IDriver* driver, TIntrusiveConstPtr) noexcept final + { TActivationContext::AsActorContext().RegisterWithSameMailbox(this); LOG_T("Prepare " << Debug()); @@ -104,7 +106,8 @@ class TReshuffleKMeansScanBase: public TActor, public return {EScan::Feed, {}}; } - EScan Seek(TLead& lead, ui64 seq) noexcept final { + EScan Seek(TLead& lead, ui64 seq) noexcept final + { LOG_T("Seek " << Debug()); if (seq == 0) { lead = std::move(Lead); @@ -125,7 +128,8 @@ class TReshuffleKMeansScanBase: public TActor, public return EScan::Final; } - TAutoPtr Finish(EAbort abort) noexcept final { + TAutoPtr Finish(EAbort abort) noexcept final + { LOG_T("Finish " << Debug()); if (Uploader) { @@ -149,11 +153,13 @@ class TReshuffleKMeansScanBase: public TActor, public return nullptr; } - void Describe(IOutputStream& out) const noexcept final { + void Describe(IOutputStream& out) const noexcept final + { out << Debug(); } - TString Debug() const { + TString Debug() const + { auto builder = TStringBuilder() << " TReshuffleKMeansScan"; if (Response) { auto& r = Response->Record; @@ -163,7 +169,8 @@ class TReshuffleKMeansScanBase: public TActor, public << " WriteBuf size: " << WriteBuf.Size() << " "; } - EScan PageFault() noexcept final { + EScan PageFault() noexcept final + { LOG_T("PageFault " << Debug()); if (!ReadBuf.IsEmpty() && WriteBuf.IsEmpty()) { @@ -175,7 +182,8 @@ class TReshuffleKMeansScanBase: public TActor, public } protected: - STFUNC(StateWork) { + STFUNC(StateWork) + { switch (ev->GetTypeRewrite()) { hFunc(TEvTxUserProxy::TEvUploadRowsResponse, Handle); cFunc(TEvents::TSystem::Wakeup, HandleWakeup); @@ -185,7 +193,8 @@ class TReshuffleKMeansScanBase: public TActor, public } } - void HandleWakeup() { + void HandleWakeup() + { LOG_T("Retry upload " << Debug()); if (!WriteBuf.IsEmpty()) { @@ -193,7 +202,8 @@ class TReshuffleKMeansScanBase: public TActor, public } } - void Handle(TEvTxUserProxy::TEvUploadRowsResponse::TPtr& ev) { + void Handle(TEvTxUserProxy::TEvUploadRowsResponse::TPtr& ev) + { LOG_T("Handle TEvUploadRowsResponse " << Debug() << " Uploader: " << Uploader.ToString() << " ev->Sender: " << ev->Sender.ToString()); @@ -230,7 +240,8 @@ class TReshuffleKMeansScanBase: public TActor, public Driver->Touch(EScan::Final); } - EScan FeedUpload() { + EScan FeedUpload() + { if (!ReadBuf.IsReachLimits(Limits)) { return EScan::Feed; } @@ -242,7 +253,8 @@ class TReshuffleKMeansScanBase: public TActor, public return EScan::Feed; } - void Upload(bool isRetry) { + void Upload(bool isRetry) + { if (isRetry) { ++RetryCount; } else { @@ -262,38 +274,41 @@ class TReshuffleKMeansScan final: public TReshuffleKMeansScanBase, private TCalc public: TReshuffleKMeansScan(const TUserTable& table, TLead&& lead, NKikimrTxDataShard::TEvReshuffleKMeansRequest& request, const TActorId& responseActorId, TAutoPtr&& response) - : TReshuffleKMeansScanBase{table, std::move(lead), request, responseActorId, std::move(response)} + : TReshuffleKMeansScanBase{table, std::move(lead), request, responseActorId, std::move(response)} { this->Dimensions = request.GetSettings().vector_dimension(); } - EScan Feed(TArrayRef key, const TRow& row) noexcept final { + EScan Feed(TArrayRef key, const TRow& row) noexcept final + { LOG_T("Feed " << Debug()); switch (UploadState) { - case EState::UPLOAD_MAIN_TO_TMP: - return FeedUploadMain2Tmp(key, row); + case EState::UPLOAD_MAIN_TO_BUILD: + return FeedUploadMain2Build(key, row); case EState::UPLOAD_MAIN_TO_POSTING: return FeedUploadMain2Posting(key, row); - case EState::UPLOAD_TMP_TO_TMP: - return FeedUploadTmp2Tmp(key, row); - case EState::UPLOAD_TMP_TO_POSTING: - return FeedUploadTmp2Posting(key, row); + case EState::UPLOAD_BUILD_TO_BUILD: + return FeedUploadBuild2Build(key, row); + case EState::UPLOAD_BUILD_TO_POSTING: + return FeedUploadBuild2Posting(key, row); default: return EScan::Final; } } private: - EScan FeedUploadMain2Tmp(TArrayRef key, const TRow& row) noexcept { + EScan FeedUploadMain2Build(TArrayRef key, const TRow& row) noexcept + { const ui32 pos = FeedEmbedding(*this, Clusters, row, EmbeddingPos, ReadStats); if (pos > K) { return EScan::Feed; } - AddRowMain2Tmp(ReadBuf, Child + pos, key, row); + AddRowMain2Build(ReadBuf, Child + pos, key, row); return FeedUpload(); } - EScan FeedUploadMain2Posting(TArrayRef key, const TRow& row) noexcept { + EScan FeedUploadMain2Posting(TArrayRef key, const TRow& row) noexcept + { const ui32 pos = FeedEmbedding(*this, Clusters, row, EmbeddingPos, ReadStats); if (pos > K) { return EScan::Feed; @@ -302,21 +317,23 @@ class TReshuffleKMeansScan final: public TReshuffleKMeansScanBase, private TCalc return FeedUpload(); } - EScan FeedUploadTmp2Tmp(TArrayRef key, const TRow& row) noexcept { + EScan FeedUploadBuild2Build(TArrayRef key, const TRow& row) noexcept + { const ui32 pos = FeedEmbedding(*this, Clusters, row, EmbeddingPos, ReadStats); if (pos > K) { return EScan::Feed; } - AddRowTmp2Tmp(ReadBuf, Child + pos, key, row); + AddRowBuild2Build(ReadBuf, Child + pos, key, row); return FeedUpload(); } - EScan FeedUploadTmp2Posting(TArrayRef key, const TRow& row) noexcept { + EScan FeedUploadBuild2Posting(TArrayRef key, const TRow& row) noexcept + { const ui32 pos = FeedEmbedding(*this, Clusters, row, EmbeddingPos, ReadStats); if (pos > K) { return EScan::Feed; } - AddRowTmp2Posting(ReadBuf, Child + pos, key, row, DataPos); + AddRowBuild2Posting(ReadBuf, Child + pos, key, row, DataPos); return FeedUpload(); } }; @@ -325,26 +342,31 @@ class TDataShard::TTxHandleSafeReshuffleKMeansScan final: public NTabletFlatExec public: TTxHandleSafeReshuffleKMeansScan(TDataShard* self, TEvDataShard::TEvReshuffleKMeansRequest::TPtr&& ev) : TTransactionBase(self) - , Ev(std::move(ev)) { + , Ev(std::move(ev)) + { } - bool Execute(TTransactionContext&, const TActorContext& ctx) final { + bool Execute(TTransactionContext&, const TActorContext& ctx) final + { Self->HandleSafe(Ev, ctx); return true; } - void Complete(const TActorContext&) final { + void Complete(const TActorContext&) final + { } private: TEvDataShard::TEvReshuffleKMeansRequest::TPtr Ev; }; -void TDataShard::Handle(TEvDataShard::TEvReshuffleKMeansRequest::TPtr& ev, const TActorContext&) { +void TDataShard::Handle(TEvDataShard::TEvReshuffleKMeansRequest::TPtr& ev, const TActorContext&) +{ Execute(new TTxHandleSafeReshuffleKMeansScan(this, std::move(ev))); } -void TDataShard::HandleSafe(TEvDataShard::TEvReshuffleKMeansRequest::TPtr& ev, const TActorContext& ctx) { +void TDataShard::HandleSafe(TEvDataShard::TEvReshuffleKMeansRequest::TPtr& ev, const TActorContext& ctx) +{ auto& record = ev->Get()->Record; TRowVersion rowVersion(record.GetSnapshotStep(), record.GetSnapshotTxId()); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_apply_build_index.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_apply_build_index.cpp index 5269cc30cdc0..24c06f9ec542 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_apply_build_index.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_apply_build_index.cpp @@ -94,7 +94,7 @@ TVector ApplyBuildIndex(TOperationId nextId, const TTxTrans for (auto& indexChildItems : index.Base()->GetChildren()) { const auto& indexImplTableName = indexChildItems.first; const auto partId = NextPartId(nextId, result); - if (NTableIndex::IsTmpImplTable(indexImplTableName)) { + if (NTableIndex::IsBuildImplTable(indexImplTableName)) { bool rejected = false; auto op = DropIndexImplTable(index, nextId, partId, indexImplTableName, indexChildItems.second, rejected); if (rejected) { diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_build_index.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_build_index.cpp index 19bacf412ed9..50eb991aaf5c 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_build_index.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_build_index.cpp @@ -134,8 +134,8 @@ TVector CreateBuildIndex(TOperationId opId, const TTxTransa result.push_back(createImplTable(CalcVectorKmeansTreePostingImplTableDesc(tableInfo, tableInfo->PartitionConfig(), implTableColumns, indexPostingTableDesc))); // TODO Maybe better to use partition from main table // This tables are temporary and handled differently in apply_build_index - result.push_back(createImplTable(CalcVectorKmeansTreePostingImplTableDesc(tableInfo, tableInfo->PartitionConfig(), implTableColumns, indexPostingTableDesc, NTableVectorKmeansTreeIndex::TmpPostingTableSuffix0))); - result.push_back(createImplTable(CalcVectorKmeansTreePostingImplTableDesc(tableInfo, tableInfo->PartitionConfig(), implTableColumns, indexPostingTableDesc, NTableVectorKmeansTreeIndex::TmpPostingTableSuffix1))); + result.push_back(createImplTable(CalcVectorKmeansTreePostingImplTableDesc(tableInfo, tableInfo->PartitionConfig(), implTableColumns, indexPostingTableDesc, NTableVectorKmeansTreeIndex::BuildPostingTableSuffix0))); + result.push_back(createImplTable(CalcVectorKmeansTreePostingImplTableDesc(tableInfo, tableInfo->PartitionConfig(), implTableColumns, indexPostingTableDesc, NTableVectorKmeansTreeIndex::BuildPostingTableSuffix1))); } else { NKikimrSchemeOp::TTableDescription indexTableDesc; // TODO After IndexImplTableDescriptions are persisted, this should be replaced with Y_ABORT_UNLESS diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_table.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_table.cpp index cfa632c31dc5..b41752f6bf5f 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_create_table.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_table.cpp @@ -448,9 +448,9 @@ class TCreateTable: public TSubOperation { if (checks) { if (parentPath.Base()->IsTableIndex()) { checks.IsInsideTableIndexPath(); - // Not tmp index impl tables can be created only as part of create index - // tmp index impl tables created multiple times during index construction - if (!NTableIndex::IsTmpImplTable(name)) { + // Not build index impl tables can be created only as part of create index + // build index impl tables created multiple times during index construction + if (!NTableIndex::IsBuildImplTable(name)) { checks .IsUnderCreating(NKikimrScheme::StatusNameConflict) .IsUnderTheSameOperation(OperationId.GetTxId()); diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_indexed_table.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_indexed_table.cpp index 9bdcb7eeb449..b2757a2241b7 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_indexed_table.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_indexed_table.cpp @@ -425,7 +425,7 @@ TVector CreateDropIndexedTable(TOperationId nextId, const T .IsTable() .NotUnderDeleting() .NotUnderOperation(); - if (!table.Parent()->IsTableIndex() || !NTableIndex::IsTmpImplTable(table.LeafName())) { + if (!table.Parent()->IsTableIndex() || !NTableIndex::IsBuildImplTable(table.LeafName())) { checks.IsCommonSensePath(); } } diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_table.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_table.cpp index 3a38fce787bc..83064e8d570d 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_table.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_table.cpp @@ -531,9 +531,9 @@ class TDropTable: public TSubOperation { checks .IsTableIndex() .IsInsideTableIndexPath(); - // Not tmp index impl tables can be dropped only as part of drop index - // tmp index impl tables dropped multiple times during index construction - if (!NTableIndex::IsTmpImplTable(name)) { + // Not build index impl tables can be dropped only as part of drop index + // build index impl tables dropped multiple times during index construction + if (!NTableIndex::IsBuildImplTable(name)) { checks .IsUnderDeleting() .IsUnderTheSameOperation(OperationId.GetTxId()); diff --git a/ydb/core/tx/schemeshard/schemeshard_build_index__progress.cpp b/ydb/core/tx/schemeshard/schemeshard_build_index__progress.cpp index d71a59293c10..9f11e32fa516 100644 --- a/ydb/core/tx/schemeshard/schemeshard_build_index__progress.cpp +++ b/ydb/core/tx/schemeshard/schemeshard_build_index__progress.cpp @@ -34,10 +34,10 @@ static constexpr const char* Name(TIndexBuildInfo::EState state) noexcept { return "Initiating"; case TIndexBuildInfo::EState::Filling: return "Filling"; - case TIndexBuildInfo::EState::DropTmp: - return "DropTmp"; - case TIndexBuildInfo::EState::CreateTmp: - return "CreateTmp"; + case TIndexBuildInfo::EState::DropBuild: + return "DropBuild"; + case TIndexBuildInfo::EState::CreateBuild: + return "CreateBuild"; case TIndexBuildInfo::EState::Applying: return "Applying"; case TIndexBuildInfo::EState::Unlocking: @@ -292,7 +292,7 @@ THolder InitiatePropose( return propose; } -THolder DropTmpPropose( +THolder DropBuildPropose( TSchemeShard* ss, const TIndexBuildInfo& buildInfo) { Y_ASSERT(buildInfo.IsBuildVectorIndex()); @@ -308,7 +308,7 @@ THolder DropTmpPropose( using namespace NTableIndex::NTableVectorKmeansTreeIndex; TString name = PostingTable; - const char* suffix = buildInfo.KMeans.Level % 2 == 0 ? TmpPostingTableSuffix0 : TmpPostingTableSuffix1; + const char* suffix = buildInfo.KMeans.Level % 2 == 0 ? BuildPostingTableSuffix0 : BuildPostingTableSuffix1; name.append(suffix); modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpDropTable); @@ -317,7 +317,7 @@ THolder DropTmpPropose( return propose; } -THolder CreateTmpPropose( +THolder CreateBuildPropose( TSchemeShard* ss, const TIndexBuildInfo& buildInfo) { Y_ASSERT(buildInfo.IsBuildVectorIndex()); @@ -347,7 +347,7 @@ THolder CreateTmpPropose( modifyScheme.SetWorkingDir(path.Dive(buildInfo.IndexName).PathString()); modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpInitiateBuildIndexImplTable); auto& op = *modifyScheme.MutableCreateTable(); - const char* suffix = buildInfo.KMeans.Level % 2 == 0 ? TmpPostingTableSuffix0 : TmpPostingTableSuffix1; + const char* suffix = buildInfo.KMeans.Level % 2 == 0 ? BuildPostingTableSuffix0 : BuildPostingTableSuffix1; op = CalcVectorKmeansTreePostingImplTableDesc(tableInfo, tableInfo->PartitionConfig(), implTableColumns, {}, suffix); const auto [count, parts, step] = ComputeKMeansBoundaries(*tableInfo, buildInfo); @@ -664,7 +664,7 @@ struct TSchemeShard::TIndexBuilder::TTxProgress: public TSchemeShard::TIndexBuil } else { if (buildInfo.IsBuildVectorIndex()) { Y_ASSERT(buildInfo.KMeans.NeedsAnotherLevel()); - ChangeState(BuildId, TIndexBuildInfo::EState::DropTmp); + ChangeState(BuildId, TIndexBuildInfo::EState::DropBuild); } else { ChangeState(BuildId, TIndexBuildInfo::EState::Filling); } @@ -764,7 +764,7 @@ struct TSchemeShard::TIndexBuilder::TTxProgress: public TSchemeShard::TIndexBuil } if (buildInfo.KMeans.NeedsAnotherLevel()) { AskToScheduleBilling(buildInfo); - ChangeState(BuildId, TIndexBuildInfo::EState::DropTmp); + ChangeState(BuildId, TIndexBuildInfo::EState::DropBuild); Progress(BuildId); break; } @@ -780,12 +780,12 @@ struct TSchemeShard::TIndexBuilder::TTxProgress: public TSchemeShard::TIndexBuil break; } - case TIndexBuildInfo::EState::DropTmp: + case TIndexBuildInfo::EState::DropBuild: Y_ASSERT(buildInfo.IsBuildVectorIndex()); if (buildInfo.ApplyTxId == InvalidTxId) { Send(Self->TxAllocatorClient, MakeHolder(), 0, ui64(BuildId)); } else if (buildInfo.ApplyTxStatus == NKikimrScheme::StatusSuccess) { - Send(Self->SelfId(), DropTmpPropose(Self, buildInfo), 0, ui64(BuildId)); + Send(Self->SelfId(), DropBuildPropose(Self, buildInfo), 0, ui64(BuildId)); } else if (!buildInfo.ApplyTxDone) { Send(Self->SelfId(), MakeHolder(ui64(buildInfo.ApplyTxId))); } else { @@ -798,16 +798,16 @@ struct TSchemeShard::TIndexBuilder::TTxProgress: public TSchemeShard::TIndexBuil Self->PersistBuildIndexApplyTxStatus(db, buildInfo); Self->PersistBuildIndexApplyTxDone(db, buildInfo); - ChangeState(BuildId, TIndexBuildInfo::EState::CreateTmp); + ChangeState(BuildId, TIndexBuildInfo::EState::CreateBuild); Progress(BuildId); } break; - case TIndexBuildInfo::EState::CreateTmp: + case TIndexBuildInfo::EState::CreateBuild: Y_ASSERT(buildInfo.IsBuildVectorIndex()); if (buildInfo.ApplyTxId == InvalidTxId) { Send(Self->TxAllocatorClient, MakeHolder(), 0, ui64(BuildId)); } else if (buildInfo.ApplyTxStatus == NKikimrScheme::StatusSuccess) { - Send(Self->SelfId(), CreateTmpPropose(Self, buildInfo), 0, ui64(BuildId)); + Send(Self->SelfId(), CreateBuildPropose(Self, buildInfo), 0, ui64(BuildId)); } else if (!buildInfo.ApplyTxDone) { Send(Self->SelfId(), MakeHolder(ui64(buildInfo.ApplyTxId))); } else { @@ -1050,8 +1050,8 @@ struct TSchemeShard::TIndexBuilder::TTxReplyRetry: public TSchemeShard::TIndexBu case TIndexBuildInfo::EState::Locking: case TIndexBuildInfo::EState::GatheringStatistics: case TIndexBuildInfo::EState::Initiating: - case TIndexBuildInfo::EState::DropTmp: - case TIndexBuildInfo::EState::CreateTmp: + case TIndexBuildInfo::EState::DropBuild: + case TIndexBuildInfo::EState::CreateBuild: case TIndexBuildInfo::EState::Applying: case TIndexBuildInfo::EState::Unlocking: case TIndexBuildInfo::EState::Done: @@ -1202,8 +1202,8 @@ struct TSchemeShard::TIndexBuilder::TTxReplySampleK: public TSchemeShard::TIndex case TIndexBuildInfo::EState::Locking: case TIndexBuildInfo::EState::GatheringStatistics: case TIndexBuildInfo::EState::Initiating: - case TIndexBuildInfo::EState::DropTmp: - case TIndexBuildInfo::EState::CreateTmp: + case TIndexBuildInfo::EState::DropBuild: + case TIndexBuildInfo::EState::CreateBuild: case TIndexBuildInfo::EState::Applying: case TIndexBuildInfo::EState::Unlocking: case TIndexBuildInfo::EState::Done: @@ -1281,8 +1281,8 @@ struct TSchemeShard::TIndexBuilder::TTxReplyUpload: public TSchemeShard::TIndexB case TIndexBuildInfo::EState::Locking: case TIndexBuildInfo::EState::GatheringStatistics: case TIndexBuildInfo::EState::Initiating: - case TIndexBuildInfo::EState::DropTmp: - case TIndexBuildInfo::EState::CreateTmp: + case TIndexBuildInfo::EState::DropBuild: + case TIndexBuildInfo::EState::CreateBuild: case TIndexBuildInfo::EState::Applying: case TIndexBuildInfo::EState::Unlocking: case TIndexBuildInfo::EState::Done: @@ -1458,8 +1458,8 @@ struct TSchemeShard::TIndexBuilder::TTxReplyProgress: public TSchemeShard::TInde case TIndexBuildInfo::EState::Locking: case TIndexBuildInfo::EState::GatheringStatistics: case TIndexBuildInfo::EState::Initiating: - case TIndexBuildInfo::EState::DropTmp: - case TIndexBuildInfo::EState::CreateTmp: + case TIndexBuildInfo::EState::DropBuild: + case TIndexBuildInfo::EState::CreateBuild: case TIndexBuildInfo::EState::Applying: case TIndexBuildInfo::EState::Unlocking: case TIndexBuildInfo::EState::Done: @@ -1537,8 +1537,8 @@ struct TSchemeShard::TIndexBuilder::TTxReplyCompleted: public TSchemeShard::TInd Self->PersistBuildIndexInitiateTxDone(db, buildInfo); break; } - case TIndexBuildInfo::EState::DropTmp: - case TIndexBuildInfo::EState::CreateTmp: + case TIndexBuildInfo::EState::DropBuild: + case TIndexBuildInfo::EState::CreateBuild: case TIndexBuildInfo::EState::Applying: case TIndexBuildInfo::EState::Cancellation_Applying: case TIndexBuildInfo::EState::Rejection_Applying: @@ -1704,8 +1704,8 @@ struct TSchemeShard::TIndexBuilder::TTxReplyModify: public TSchemeShard::TIndexB ifErrorMoveTo(TIndexBuildInfo::EState::Rejection_Unlocking); break; } - case TIndexBuildInfo::EState::DropTmp: - case TIndexBuildInfo::EState::CreateTmp: + case TIndexBuildInfo::EState::DropBuild: + case TIndexBuildInfo::EState::CreateBuild: case TIndexBuildInfo::EState::Applying: case TIndexBuildInfo::EState::Rejection_Applying: { @@ -1818,8 +1818,8 @@ struct TSchemeShard::TIndexBuilder::TTxReplyAllocate: public TSchemeShard::TInde Self->PersistBuildIndexInitiateTxId(db, buildInfo); } break; - case TIndexBuildInfo::EState::DropTmp: - case TIndexBuildInfo::EState::CreateTmp: + case TIndexBuildInfo::EState::DropBuild: + case TIndexBuildInfo::EState::CreateBuild: case TIndexBuildInfo::EState::Applying: case TIndexBuildInfo::EState::Cancellation_Applying: case TIndexBuildInfo::EState::Rejection_Applying: diff --git a/ydb/core/tx/schemeshard/schemeshard_build_index_tx_base.cpp b/ydb/core/tx/schemeshard/schemeshard_build_index_tx_base.cpp index f6f9749584a2..022a6d272951 100644 --- a/ydb/core/tx/schemeshard/schemeshard_build_index_tx_base.cpp +++ b/ydb/core/tx/schemeshard/schemeshard_build_index_tx_base.cpp @@ -209,8 +209,8 @@ void TSchemeShard::TIndexBuilder::TTxBase::Fill(NKikimrIndexBuilder::TIndexBuild index.SetProgress(0.0); break; case TIndexBuildInfo::EState::Filling: - case TIndexBuildInfo::EState::DropTmp: - case TIndexBuildInfo::EState::CreateTmp: + case TIndexBuildInfo::EState::DropBuild: + case TIndexBuildInfo::EState::CreateBuild: index.SetState(Ydb::Table::IndexBuildState::STATE_TRANSFERING_DATA); index.SetProgress(indexInfo.CalcProgressPercent()); break; diff --git a/ydb/core/tx/schemeshard/schemeshard_info_types.h b/ydb/core/tx/schemeshard/schemeshard_info_types.h index 6f665064eab4..46de9b7432af 100644 --- a/ydb/core/tx/schemeshard/schemeshard_info_types.h +++ b/ydb/core/tx/schemeshard/schemeshard_info_types.h @@ -2910,8 +2910,8 @@ struct TIndexBuildInfo: public TSimpleRefCount { GatheringStatistics = 20, Initiating = 30, Filling = 40, - DropTmp = 45, - CreateTmp = 46, + DropBuild = 45, + CreateBuild = 46, Applying = 50, Unlocking = 60, Done = 200, diff --git a/ydb/core/tx/schemeshard/schemeshard_path_describer.cpp b/ydb/core/tx/schemeshard/schemeshard_path_describer.cpp index 977c22e51f6b..416954aa4b8c 100644 --- a/ydb/core/tx/schemeshard/schemeshard_path_describer.cpp +++ b/ydb/core/tx/schemeshard/schemeshard_path_describer.cpp @@ -1325,7 +1325,7 @@ void TSchemeShard::DescribeTableIndex(const TPathId& pathId, const TString& name Y_ABORT_UNLESS(indexPathPtr); const auto& indexPath = *indexPathPtr->Get(); if (const auto size = indexPath.GetChildren().size(); indexInfo->Type == NKikimrSchemeOp::EIndexType::EIndexTypeGlobalVectorKmeansTree) { - // For vector index we have 2 impl tables and 2 tmp impl tables + // For vector index we have 2 impl tables and 2 build impl tables Y_VERIFY_S(2 <= size && size <= 4, size); } else { Y_VERIFY_S(size == 1, size); @@ -1334,8 +1334,8 @@ void TSchemeShard::DescribeTableIndex(const TPathId& pathId, const TString& name ui64 dataSize = 0; for (const auto& indexImplTablePathId : indexPath.GetChildren()) { const auto* tableInfoPtr = Tables.FindPtr(indexImplTablePathId.second); - if (!tableInfoPtr && NTableIndex::IsTmpImplTable(indexImplTablePathId.first)) { - continue; // it's possible because of dropping tmp index impl tables without dropping index + if (!tableInfoPtr && NTableIndex::IsBuildImplTable(indexImplTablePathId.first)) { + continue; // it's possible because of dropping build index impl tables without dropping index } Y_ABORT_UNLESS(tableInfoPtr); const auto& tableInfo = *tableInfoPtr->Get();